In [1]:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import mpl_toolkits as mplot3d
import scipy as sp
pd.set_option("display.max_columns", None)
from tqdm import tqdm
tqdm.pandas()
In [2]:
def lighten_color(color, amount=0.5):
    """
    Lightens the given color by multiplying (1-luminosity) by the given amount.
    Input can be matplotlib color string, hex string, or RGB tuple.

    Examples:
    >> lighten_color('g', 0.3)
    >> lighten_color('#F034A3', 0.6)
    >> lighten_color((.3,.55,.1), 0.5)
    """
    import matplotlib.colors as mc
    import colorsys
    try:
        c = mc.cnames[color]
    except:
        c = color
    c = colorsys.rgb_to_hls(*mc.to_rgb(c))
    return colorsys.hls_to_rgb(c[0], 1 - amount * (1 - c[1]), c[2])

DATA CLEANING AND WRANGLING¶

Typeform Data¶

In [3]:
d0 = pd.read_csv('India_riskliteracy_dataset_above median_2024_new.csv').rename({"#":"ResponseId"}, axis = 1)
d0 = d0.loc[ (d0["Please state your current occupation."] != "Investment Professional, i.e. stock broker/trader; financial planner/advisor; portfolio manager; investment banker; stock analyst; venture capital/private equity; insurance agent, etc.") & (d0["Please state your current occupation."] != "Student") ]
d0
Out[3]:
ResponseId Unnamed: 1 #.1 Please indicate your Gender. Please mark your age (in years) What is currently your highest Education? Please state your current occupation. How do you describe your willingness to take financial risk in general? Given the number of years that you have held various investments and the amount of investing you might have done, what degree of investment experience in the stock market do you have? If an expert tries to worry or scare me, i.e. a financial advisor about my financial situation, I choose another expert. I only buy a financial product I understand. I trust doctors. When I want to buy a bigger item like a refrigerator or an expensive item of clothing, I wait a month to see whether I still want it and only buy it then. I always keep in mind that everything I do on the web could be used to my disadvantage. In my household, we/I spend: In my household, we/I _Distribution 1_\n\nHow risky do you perceive the investment to be? _Distribution 2_\n\nHow risky do you perceive the investment to be? _Distribution 3_\n\nHow risky do you perceive the investment to be? _Distribution 4_\n\nHow risky do you perceive the investment to be? _Distribution 5_\n\nHow risky do you perceive the investment to be? Distribution 6\n\nHow risky do you perceive the investment to be? Distribution 7\n\nHow risky do you perceive the investment to be? Distribution 8\n\nHow risky do you perceive the investment to be? *Mumbai * A = 9 out of 10000 *OR * B = 1 out of 1000 *Bengaluru * A = 0.7% *OR * B = 0.099% *Kolkata * A = 0.61% *OR * B = 6 out of 10000 HIV test Fingerprint DNA test Cancer screening test Professional horoscope A study estimates that eating 100g chocolate everyday increases the risk of obesity by 20%. Which of the following statements is true? There is an official prediction that the national stock market will grow 2% annually over the next 5 years. This means that… Imagine you are told that the price of the stock Soya Ruchi increases from INR 60 to INR 120 after the company merger. What does this mean? It is predicted that Indigo Bank has 30% chance of default next year. Which of the following alternatives is the most appropriate interpretation of the statement? The probability that the economy will go into a recession this year is 30%. If the economy goes into recession, the probability that the stock market will decrease is 80%. If the economy does not go into a recession, the probability that the stock market will decrease is 23%. What is the probability that the economy goes into recession given that the stock market decreased? A new policy intervention increases the number of people who are employed by 20%. This statistic implies that the intervention increases the number of people who are employed from: Imagine you are told that a new medication increases the number of people who recover from a disease from 2 out of 1,000 to 4 out of 1,000. This implies: Imagine that we flip a fair coin 1,000 times. What is your best guess about how many times the coin will come up heads in 1,000 flips? \n\n\_\_\_\_\_\_ times out of 1,000. In the Bingo Lottery, the chance of winning a $10 prize is 1%. What is your best guess about how many people will win a $10 prize if 1,000 people each buy a single ticket for Bingo Lottery?\n\n\_\_\_\_\_\_ person(s) out of 1,000. In a sweepstakes, the chance of winning a car is 1 in 1,000. What percentage of tickets for the sweepstakes wins a car?\n\n\_\_\_\_\_ % of tickets About 10 out of 1,000 children develop Down syndrome. In a Down syndrome test, 9 out of these 10 children with Down syndrome tested positive. Out of the 990 children without Down syndrome 50 nevertheless tested positive. Among those women with a positive test result concerning their child how many actually have a child with Down syndrome? [Select one response only] Approximately what percentage (%) of people who die from cancer die from colon cancer, breast cancer, and prostate cancer taken together? The following figure shows the number of men and women among a group of smartphone users. The total number of circles is 100. \n\nHow many more men than women are there among the 100 people using a smartphone? In a magazine you see two advertisements, one on page 5 and another on page 12. Each is for a different drug for treating heart disease, and each includes a graph showing the effectiveness of the drug compared to a placebo (sugar pill).\n\nCompared to the placebo, which treatment leads to a larger decrease in the percentage of patients who die? Please indicate your approximate annual personal income from all sources for last year Please provide a rough guess (in Indian Rupees) of the worth of your household's assets. Please do not forget to correct it for your debts, such as a mortgage or any loans you might have. uid Response Type Start Date (UTC) Stage Date (UTC) Submit Date (UTC) Network ID LTA q8_2_1 q8_2_2 q8_2_3 q8_2_4 q8_2_5 q8_3 q8_4 q8_5berlin_1 q8_5london_1 q8_5paris_1 q8_6 q8_7 q9_1_1 q9_2_1 q9_3 q10_1_1 q10_2_1 q10_3_1 q10_4 certainty1 certainty2 certainty3 certainty4 certainty5 uncertainty1 uncertainty2 numeracy1 numeracy2 numeracy3 numeracy4 numeracy5 graph1 graph2 graph3 riskcalculation1 riskcalculation2 riskcalculation3 riskcalculation4
1 00ujdxbfoya0donu8r00ujcjdkojc99x 428 00ujdxbfoya0donu8r00ujcjdkojc99x Female 25 - 35 Under Graduate Employee/Consultant in Other than the Finance ... 7 8 Completely Completely Completely Moderately Moderately less than half of the household income and sav... write down budget and spending, and have an em... 2 1 1 1 0 2 0 0 B B A Yes Yes Yes Yes No The higher the quality of the study, the more ... the growth rate over five years will be betwee... the stock price increased by 50% The bank will default on 30% of repayments in ... 50% 100 in 10,000 people prior to the intervention... The medication increases recovery by 50% 500 100 1 59 out of 1000 50 10 They are equal < 5,00,000 1500000 MXic21725178744djB completed 2024-09-01 08:23:04 NaN 2024-09-01 09:24:44 1c1d51349c 42.824074 1 1 1 1 2 2 3 2 2 1 2 2 50 10 3 500 100 1 3 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 0
3 022xoawhrghfhv4a1g022xmz7hb0m41f 442 022xoawhrghfhv4a1g022xmz7hb0m41f Female 46 - 55 Under Graduate Entrepreneur or Own Business 5 4 Somewhat Somewhat Moderately Just about Somewhat all or more than the household income, even th... spend as it feel right, and do not have an eme... 4 4 4 4 4 4 4 4 B A B Yes Yes Yes No No The lower the quality of the study, the more l... the growth rate will be 0.4% on average each year the stock price increased by 60% 30% of the banks customers will default next year 80% 5 in 100 people prior to the intervention to 6... The medication increases recovery by 2% 500 1 1 59 out of 1000 17 65 They are equal < 5,00,000 15000000 MXFDH1725178659xRn completed 2024-09-01 08:21:14 NaN 2024-09-01 08:33:49 fbd8962401 8.738426 1 1 1 2 2 1 1 2 1 2 3 1 17 65 3 500 1 1 3 0 0 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 0 0
4 02pxtdbyibecqqfvwlw02pxwfbane9zd 558 02pxtdbyibecqqfvwlw02pxwfbane9zd Female 46 - 55 Post Graduate Employee/Consultant in Other than the Finance ... 6 10 Not at all Completely Completely Completely Moderately all or more than the household income, even th... have an emergency fund, and spend as it feels ... 5 5 6 5 7 5 0 5 B A A Yes Yes Yes No Yes The higher the quality of the study, the more ... it is not possible to predict the growth rate ... an answer is not possible based on the informa... 30% of the banks customers will default next year 30% 5 in 100 people prior to the intervention to 6... None of the above is implied. 1000 1 100 9 out of 10 20 20 Can’t say 5,00,000 - 15,00,000 3000000 MXIpM1724844742xet completed 2024-08-28 11:35:05 NaN 2024-08-28 11:48:47 e8b668d11b 9.513889 1 1 1 2 1 2 4 2 1 1 4 1 20 20 4 1000 1 100 2 0 0 0 1 0 0 1 1 1 1 0 0 0 1 0 0 0 0 0
5 037aefjdt26mnjd102nz0pk037aedfhc 544 037aefjdt26mnjd102nz0pk037aedfhc Male 46 - 55 Post Graduate Employee/Consultant in Other than the Finance ... 3 6 Somewhat Somewhat Somewhat Somewhat Somewhat more than half of the household income and sav... write down budget and spending, but have no em... 3 1 6 1 2 6 7 5 A B A No No Yes No No Irrespective of the quality of the study, futu... it is not possible to predict the growth rate ... an answer is not possible based on the informa... Banks similar to Indigo will default 30% of th... 60% 70 in 100 people prior to the intervention to ... None of the above is implied. 1000 1 10 9 out of 59 50 20 Hertinol 5,00,000 - 15,00,000 7000000 MXpv61724844846UVs completed 2024-08-28 11:35:50 NaN 2024-08-28 11:45:54 f51b723011 6.990741 2 2 1 2 2 3 4 1 2 1 4 3 50 20 2 1000 1 10 1 1 1 0 1 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1
7 047u13akxwyg4n0472cel5lo9pqsx9hv 140 047u13akxwyg4n0472cel5lo9pqsx9hv Female 25 - 35 Under Graduate Employee/Consultant in Other than the Finance ... 3 0 Somewhat Moderately Moderately Somewhat Somewhat more than half of the household income and sav... have an emergency fund, and spend as it feels ... 2 1 3 3 6 6 0 4 B A B No Yes Yes Yes No The lower the quality of the study, the more l... it is not possible to predict the growth rate ... the stock price increased by 60% 30% of the banks customers will default next year 80% 100 in 10,000 people prior to the intervention... The medication increases recovery by 2% 700 10 1 9 out of 10 50 20 Hertinol 5,00,000 - 15,00,000 300000 MXYNb1725943123FgB completed 2024-09-10 04:41:40 NaN 2024-09-10 05:22:48 81ad724e0d 28.564815 2 1 1 1 2 1 4 2 1 2 3 2 50 20 2 700 10 1 2 1 0 0 0 1 1 1 1 1 0 0 0 0 1 0 0 1 0 0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
637 zcj7ldokhyo6217f9sriwizcj7ldodwt 268 zcj7ldokhyo6217f9sriwizcj7ldodwt Female 36 - 45 Under Graduate Entrepreneur or Own Business 5 8 Completely Completely Completely Not at all Moderately less than half of the household income and sav... write down budget and spending, and have an em... 2 0 7 5 5 7 0 4 A B A No Yes Yes No No The higher the quality of the study, the more ... it is not possible to predict the growth rate ... the stock price increased by 100% Banks similar to Indigo will default 30% of th... 80% it is not possible to determine which of the a... The medication increases recovery by 2% 500 10 1 9 out of 59 25 60 Hertinol 15,00,001 - 25,00,000 600000000 MX6PC1725259690mDV completed 2024-09-02 06:53:29 NaN 2024-09-02 07:28:48 237c2e5291 24.525463 2 1 1 2 2 2 4 1 2 1 3 4 25 60 2 500 10 1 1 1 0 0 1 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1
639 zfemo30rg0ekva18x1kjwzfemo2wpg2p 185 zfemo30rg0ekva18x1kjwzfemo2wpg2p Male 36 - 45 Ph.D. or higher Employee/Consultant in Other than the Finance ... 6 8 Not at all Moderately Just about Not at all Not at all less than half of the household income and sav... have an emergency fund, and spend as it feels ... 3 1 4 2 0 5 0 2 B A A No Yes Yes No No Irrespective of the quality of the study, futu... the growth rate over five years will be betwee... the stock price increased by 100% 30% of central bankers think that Indigo Bank ... 30% 100 in 10,000 people prior to the intervention... The medication increases recovery by 100% 500 10 1 59 out of 1000 25 20 Can’t say 15,00,001 - 25,00,000 8500000 MXUxt1725260651heG completed 2024-09-02 07:08:18 NaN 2024-09-02 07:23:09 fbb956cffc 10.312500 2 1 1 2 2 4 3 2 1 1 1 2 25 20 4 500 10 1 3 1 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 1 0 0
640 znqvw4t38br3072znqvwvjsgb6wvj7nt 305 znqvw4t38br3072znqvwvjsgb6wvj7nt Female 36 - 45 Post Graduate Entrepreneur or Own Business 5 5 Somewhat Completely Just about Moderately Somewhat less than half of the household income and sav... spend as it feel right, and do not have an eme... 0 0 0 1 0 0 0 0 B B B Yes Yes Yes No No Irrespective of the quality of the study, futu... it is not possible to predict the growth rate ... the stock price increased by 50% 30% of the banks customers will default next year 80% it is not possible to determine which of the a... The medication increases recovery by 2% 500 10 1 9 out of 59 25 20 Hertinol 5,00,000 - 15,00,000 2000000 MXd921725259652XDJ completed 2024-09-02 06:49:56 NaN 2024-09-02 07:17:20 1964f49e1c 19.027778 1 1 1 2 2 3 4 2 2 2 3 4 25 20 2 500 10 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 0 1
641 zstpq23h1x3ilab8s8vsrbkw8t4zstpq 306 zstpq23h1x3ilab8s8vsrbkw8t4zstpq Male 18 - 25 Under Graduate Entrepreneur or Own Business 6 9 Completely Completely Moderately Completely Moderately all or more than our household income, because... have an emergency fund, and spend as it feels ... 6 3 7 1 2 7 7 3 A A B No Yes Yes No No The higher the quality of the study, the more ... the growth rate over five years will be betwee... the stock price increased by 60% Banks similar to Indigo will default 30% of th... 80% 5 in 100 people prior to the intervention to 6... None of the above is implied. 750 10 1 59 out of 1000 50 10 They are equal 5,00,000 - 15,00,000 60000000 MXfmg1725259705Fkj completed 2024-09-02 06:49:52 NaN 2024-09-02 07:01:04 03aa77ec48 7.777778 2 1 1 2 2 2 3 1 1 2 4 1 50 10 3 750 10 1 3 1 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0
642 ztfdlcbiyo1xco3ztfdl4ozqpte2q3m9 95 ztfdlcbiyo1xco3ztfdl4ozqpte2q3m9 Male 25 - 35 Post Graduate Entrepreneur or Own Business 6 7 Somewhat Just about Completely Moderately Somewhat more than half of the household income and sav... spend as it feel right, and do not have an eme... 6 0 2 5 3 7 0 4 B A A No Yes Yes Yes Yes The higher the quality of the study, the more ... it is not possible to predict the growth rate ... the stock price increased by 100% 30% of central bankers think that Indigo Bank ... 80% 5 in 100 people prior to the intervention to 6... The medication increases recovery by 2% 500 10 1 59 out of 1000 25 60 Can’t say 15,00,001 - 25,00,000 5000000 MXjp51725955476hMt completed 2024-09-10 08:06:34 NaN 2024-09-10 08:16:35 f68294192e 6.956019 2 1 1 1 1 2 4 2 1 1 3 1 25 60 4 500 10 1 3 1 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 0

482 rows × 93 columns

In [4]:
d0["Please state your current occupation."].value_counts()
Out[4]:
Please state your current occupation.
Employee/Consultant in Other than the Finance Sector    378
Entrepreneur or Own Business                             96
Home Maker or not employed                                5
Retired person                                            3
Name: count, dtype: int64

Demographics¶

In [5]:
# Age groups/rec = [2,3,4]
# Age group 2 = 18 to 35 y/o
# Age group 3 = 36 to 55 y/o
# Age group 4 = 56 to 75 y/o (75 y/o, i.e, within the scope of the data we have, it can mean 60 and above also)

d0["age_rec"] = np.where( d0["Please mark your age (in years)"] == "18 - 25" , 2,
                          np.where(d0["Please mark your age (in years)"] == "25 - 35", 2,
                                   np.where( d0["Please mark your age (in years)"] == "36 - 45", 3,
                                            np.where( d0["Please mark your age (in years)"] == "46 - 55", 3,
                                                     np.where( d0["Please mark your age (in years)"] == "56 - 65", 4,
                                                              np.where( d0["Please mark your age (in years)"] == "Above 65", 4, 0
                                                                      )
                                                             )
                                                    )
                                           )
                                  )
                        )

d0["age"] = np.where( d0["Please mark your age (in years)"] == "18 - 25" , (18 + 25) / 2,
                          np.where(d0["Please mark your age (in years)"] == "25 - 35", (26 + 35) / 2,
                                   np.where( d0["Please mark your age (in years)"] == "36 - 45", (36 + 45) / 2,
                                            np.where( d0["Please mark your age (in years)"] == "46 - 55", (46 + 55) / 2,
                                                     np.where( d0["Please mark your age (in years)"] == "56 - 65", (56 + 65) / 2,
                                                              np.where( d0["Please mark your age (in years)"] == "Above 65", (66 + 75) / 2, 0
                                                                      )
                                                             )
                                                    )
                                           )
                                  )
                        )


# Secondary upto 10 – ISCED 3
# Senior Secondary upto 12 - ISCED 3 
# Diploma and voca – ISCED 2
# UG – ISCED 2
# PG – ISCED 1
# PhD and higher – ISCED 1

d0["isced"] = np.where(d0["What is currently your highest Education?"] == "Post Graduate", 1,
                        np.where(d0["What is currently your highest Education?"] == "Under Graduate", 2,
                                 np.where(d0["What is currently your highest Education?"] == "Ph.D. or higher", 1,
                                          np.where(d0["What is currently your highest Education?"] == "Diploma or vocation training", 2,
                                                   np.where(d0["What is currently your highest Education?"] == "School degree (X or XII)", 3, 0
                                                           )
                                                  )
                                         )
                                )
                       )

d0["income"] = np.where(d0["Please indicate your approximate annual personal income from all sources for last year"] == "< 5,00,000", 1,
                         np.where(d0["Please indicate your approximate annual personal income from all sources for last year"] == "5,00,000 - 15,00,000", 2,
                                  np.where(d0["Please indicate your approximate annual personal income from all sources for last year"] == "15,00,001 - 25,00,000", 3,
                                           np.where(d0["Please indicate your approximate annual personal income from all sources for last year"] == "25,00,001 - 35,00,000", 4,
                                                    np.where(d0["Please indicate your approximate annual personal income from all sources for last year"] == "35,00,001 - 45,00,000", 4,
                                                             np.where( d0["Please indicate your approximate annual personal income from all sources for last year"] == "> 45,00,000", 5,0
                                                                     )
                                                            )
                                                   )
                                           )
                                  )
                         )

d0["wealth"] = d0["Please provide a rough guess (in Indian Rupees) of the worth of your household's assets. Please do not forget to correct it for your debts, such as a mortgage or any loans you might have."]

Scoring¶

In [6]:
d0["Certainty_3"] = d0["certainty1"] + d0["certainty2"] + d0["certainty3"]
d0["RiskComprehension_3"] = d0["riskcalculation1"] + d0["riskcalculation2"] + d0["riskcalculation3"] + d0["riskcalculation4"]
d0["GraphLiteracy_3"] = d0["graph1"] + d0["graph2"] + d0["graph3"]
d0["Numeracy_3"] = d0["numeracy1"] + d0["numeracy2"] + d0["numeracy3"]
d0["Bayesianreasoning_1"] = d0["numeracy4"]
d0["TotalScore_13"] = d0["Certainty_3"] + d0["RiskComprehension_3"] + d0["GraphLiteracy_3"] + d0["Numeracy_3"] + d0["Bayesianreasoning_1"]

d0["Certainty_%"] = d0["Certainty_3"] / 3 * 100
d0["RiskComprehension_%"] = d0["RiskComprehension_3"] / 4 * 100
d0["GraphLiteracy_%"] = d0["GraphLiteracy_3"] / 3 * 100
d0["Numeracy_%"] = d0["Numeracy_3"] / 3 * 100
d0["Bayesianreasoning_%"] = d0["Bayesianreasoning_1"] / 1 * 100

d0["TotalScore_%"] = d0["TotalScore_13"] / 14 * 100


colReq = ["ResponseId", "age", "age_rec", "isced", "income", "wealth", "Certainty_3", "RiskComprehension_3", "GraphLiteracy_3",
          "Numeracy_3", "Bayesianreasoning_1", "Certainty_%", "RiskComprehension_%", "GraphLiteracy_%", "Numeracy_%", "Bayesianreasoning_%",
          "TotalScore_13", "TotalScore_%",]

d01 = d0[colReq].copy()
d01
Out[6]:
ResponseId age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
1 00ujdxbfoya0donu8r00ujcjdkojc99x 30.5 2 2 1 1500000 0 1 1 2 0 0.000000 25.0 33.333333 66.666667 0.0 4 28.571429
3 022xoawhrghfhv4a1g022xmz7hb0m41f 50.5 3 2 1 15000000 0 1 1 2 0 0.000000 25.0 33.333333 66.666667 0.0 4 28.571429
4 02pxtdbyibecqqfvwlw02pxwfbane9zd 50.5 3 1 2 3000000 0 0 1 3 0 0.000000 0.0 33.333333 100.000000 0.0 4 28.571429
5 037aefjdt26mnjd102nz0pk037aedfhc 50.5 3 1 2 7000000 2 1 1 1 0 66.666667 25.0 33.333333 33.333333 0.0 5 35.714286
7 047u13akxwyg4n0472cel5lo9pqsx9hv 30.5 2 2 2 300000 1 1 1 2 0 33.333333 25.0 33.333333 66.666667 0.0 5 35.714286
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
637 zcj7ldokhyo6217f9sriwizcj7ldodwt 40.5 3 2 3 600000000 1 3 1 1 0 33.333333 75.0 33.333333 33.333333 0.0 6 42.857143
639 zfemo30rg0ekva18x1kjwzfemo2wpg2p 40.5 3 1 3 8500000 1 2 2 3 1 33.333333 50.0 66.666667 100.000000 100.0 9 64.285714
640 znqvw4t38br3072znqvwvjsgb6wvj7nt 40.5 3 1 2 2000000 0 3 2 1 0 0.000000 75.0 66.666667 33.333333 0.0 6 42.857143
641 zstpq23h1x3ilab8s8vsrbkw8t4zstpq 21.5 2 2 2 60000000 1 1 1 1 0 33.333333 25.0 33.333333 33.333333 0.0 4 28.571429
642 ztfdlcbiyo1xco3ztfdl4ozqpte2q3m9 30.5 2 1 3 5000000 1 2 1 3 0 33.333333 50.0 33.333333 100.000000 0.0 7 50.000000

482 rows × 18 columns

In [ ]:
 
In [ ]:
 
In [ ]:
 

BeSample Data¶

In [7]:
d1 = pd.read_csv('Indian Risk Survey_Besample_Filtered_12_2024.csv')
d11 = d1.iloc[:, 19:62].copy()
d11.insert(0, "ResponseId",0)
d11["ResponseId"] = d1["ResponseId"].copy()
d11 = d11.loc[ (d11["Q4"] != "Student") & (d11["Q4"] != "Stock analyst") & (d11["Q4"] != "Insurance agent, etc") & (d11["Q4"] != "Venture capital/private equity")]
d11
Out[7]:
ResponseId Q0 Q1 Q2 Q3 Q4 Q5_1 Q6_1 Q8_1 Q8_2 Q8_3 Q8_4 Q8_5 Q8_6 Q8_7 Q8_8 Q9b_1 Q9b_4 Q9b_5 Q9b_6 Q9b_7 Q9b_8 Q9b_9 Q11a_1 Q11a_2 Q11a_3 Q11b Q11c Q11d Q11h Attention Check Q11i Q12a Q12b Q12c Q13a Q13b Q13c Q13d Q14a Q14b Q14c Q15a Q14b.1
1 R_4F8RqnI7xnwXmBY Yes, I would like to participate in the study ... Male 41 Undergraduate Program Salaried/Employee/Consultant in a sector other... 6 9 4 4 4 4 4 5 4 5 10.0 30.0 0 0 20.0 40 0.0 2 1 1 HIV test,Fingerprint,DNA test Irrespective of the quality of the study, futu... It is not possible to predict the growth rate ... 100 in 10,000 people prior to the intervention... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account False 500 10 0.10 59 out of 1000 25.0 20 Can’t say INR 500,001 – INR 15,00,000 5000000.0
4 R_4TMr0yMiNpsJBr5 Yes, I would like to participate in the study ... Male 37 Undergraduate Program Salaried/Employee/Consultant in a sector other... 3 1 4 5 5 6 (strongly agree) 6 (strongly agree) 6 (strongly agree) 6 (strongly agree) 2 70.0 10.0 0 0 0.0 10 10.0 2 1 1 HIV test,Fingerprint,DNA test,Cancer screening... The higher the quality of the study, the more ... The growth rate over five years will be exactl... 100 in 10,000 people prior to the intervention... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account False 500 10 0.10 59 out of 1000 25.0 20 They are equal < INR 500,000 1000000.0
7 R_4lDL0HKQBvz3esp Yes, I would like to participate in the study ... Male 29 Undergraduate Program Entrepreneur/Business Owner in a sector other ... 7 (willing to take risk) 3 1 (strongly disagree) 2 3 4 6 (strongly agree) 4 4 1 (strongly disagree) 70.0 10.0 0 5 0.0 10 5.0 2 2 1 HIV test,Fingerprint,DNA test,Cancer screening... The higher the quality of the study, the more ... The growth rate over five years will be exactl... 70 in 100 people prior to the intervention to ... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account True 500 10 0.10 9 out of 10 25.0 20 They are equal INR 500,001 – INR 15,00,000 500000.0
8 R_4MNcacFfRQwplfz Yes, I would like to participate in the study ... Male 27 Post-Graduate Program Salaried/Employee/Consultant in a sector other... 0 (unwilling to take risk) 0 (no investment experience) 3 4 3 3 6 (strongly agree) 4 4 5 20.0 10.0 0 0 20.0 30 20.0 2 2 1 Fingerprint The higher the quality of the study, the more ... The growth rate will be 0.4% on average each year 100 in 10,000 people prior to the intervention... Vase None of the above is implied More than $102 Less than today with the money in this account False 500 100 0.10 9 out of 10 10.0 20 Crosicol INR 500,001 – INR 15,00,000 10000000.0
9 R_4Ecp6YekNbrMCwi Yes, I would like to participate in the study ... Male 39 Post-Graduate Program Entrepreneur/Business Owner in a sector other ... 4 7 5 5 6 (strongly agree) 5 5 6 (strongly agree) 5 6 (strongly agree) 80.0 20.0 0 0 0.0 0 0.0 2 1 1 Fingerprint The higher the quality of the study, the more ... The growth rate over five years will be exactl... 5 in 100 people prior to the intervention to 6... Vase The medication increases recovery by 2% More than $102 Less than today with the money in this account False 1000 10 10.00 9 out of 10 25.0 60 Crosicol < INR 500,000 165000.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
364 R_4zPiSk23ayGvFD4 Yes, I would like to participate in the study ... Male 70 Undergraduate Program Salaried/Employee/Consultant in a sector other... 4 6 4 4 4 4 5 5 5 4 15.0 20.0 10 0 25.0 30 0.0 2 1 1 DNA test The higher the quality of the study, the more ... It is not possible to predict the growth rate ... It is not possible to determine which of the a... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account False 500 10 1.00 59 out of 1000 25.0 20 Crosicol INR 1500,001 – INR 30,00,000 7000000.0
365 R_47eRbAoGWc5Ttzb Yes, I would like to participate in the study ... Male 48 Post-Graduate Program Salaried/Employee/Consultant in a sector other... 0 (unwilling to take risk) 1 4 5 4 5 5 2 3 6 (strongly agree) 50.0 10.0 10 20 2.0 5 3.0 1 1 1 Professional horoscope Irrespective of the quality of the study, futu... The growth rate over five years will be exactl... 70 in 100 people prior to the intervention to ... Vase The medication increases recovery by 2% Refuse to answer Exactly the same as today with the money in th... False 500 68 0.01 59 out of 100 50.0 40 They are equal < INR 500,000 50000.0
366 R_4eWLoP4wkX5K1kl Yes, I would like to participate in the study ... Male 22 Undergraduate Program Salaried/Employee/Consultant in a sector other... 5 6 5 5 4 5 5 6 (strongly agree) 5 4 70.0 15.0 0 0 15.0 0 0.0 2 1 2 Cancer screening test The higher the quality of the study, the more ... The growth rate over five years will be exactl... It is not possible to determine which of the a... Vase The medication increases recovery by 2% More than $102 More than today with the money in this account False 500 50 0.10 9 out of 59 25.0 20 They are equal < INR 500,000 800000.0
368 R_42y9IJJWALsuHPF Yes, I would like to participate in the study ... Male 28 Undergraduate Program Salaried/Employee/Consultant in a sector other... 6 7 6 (strongly agree) 3 5 5 6 (strongly agree) 6 (strongly agree) 6 (strongly agree) 5 4.0 0.0 0 0 6.0 40 50.0 2 1 1 HIV test,Fingerprint,DNA test,Cancer screening... The higher the quality of the study, the more ... The growth rate over five years will be betwee... 70 in 100 people prior to the intervention to ... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account False 600 10 0.10 9 out of 10 25.0 5 Hertinol INR 1500,001 – INR 30,00,000 4500000.0
369 R_8k6D0jzzHCC5X3Z Yes, I would like to participate in the study ... Male 25 Undergraduate Program Salaried/Employee/Consultant in a sector other... 7 (willing to take risk) 8 6 (strongly agree) 5 5 4 6 (strongly agree) 6 (strongly agree) 6 (strongly agree) 5 5.0 5.0 5 5 30.0 20 30.0 2 1 1 DNA test The higher the quality of the study, the more ... It is not possible to predict the growth rate ... 5 in 100 people prior to the intervention to 6... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account False 500 500 50.00 59 out of 1000 25.0 10 Hertinol > INR 75,00,000 8000000.0

250 rows × 44 columns

In [8]:
d11["Q4"].value_counts()
Out[8]:
Q4
Salaried/Employee/Consultant in a sector other than Finance    167
Not employed                                                    50
Entrepreneur/Business Owner in a sector other than Finance      30
Retired                                                          3
Name: count, dtype: int64
In [9]:
d11["age"] = d11["Q2"]

# Age groups/rec = [2,3,4]
# Age group 2 = 18 to 35 y/o
# Age group 3 = 36 to 55 y/o
# Age group 4 = 56 to 75 y/o (75 y/o, i.e, within the scope of the data we have, it can mean 60 and above also)

d11["age_rec"] = np.where( (d11["age"] >= 18) & (d11["age"] <= 35), 2,
                          np.where( (d11["age"] >= 36) & (d11["age"] <= 55), 3,
                                   np.where( (d11["age"] >= 56), 4, 0
                                           )
                                  )
                         )


# Secondary upto 10 – ISCED 3
# Senior Secondary upto 12 - ISCED 3 
# Diploma and voca – ISCED 2
# UG – ISCED 2
# PG – ISCED 1
# PhD and higher – ISCED 1

d11["isced"] = np.where(d11["Q3"] == "Post-Graduate Program", 1,
                        np.where(d11["Q3"] == "Undergraduate Program", 2,
                                 np.where(d11["Q3"] == "Ph.D. and higher", 1,
                                          np.where(d11["Q3"] == "Diploma and Vocational Training", 2,
                                                   np.where(d11["Q3"] == "Secondary School (11th to 12th Std.)", 3,
                                                            np.where( d11["Q3"] == "Primary School (up to 10th Std.)", 3,
                                                                     np.where( d11["Q3"] == "M.Phil.", 1, 0
                                                                             )
                                                                    )
                                                           )
                                                  )
                                         )
                                )
                       )

d11["income"] = np.where(d11["Q15a"] == "< INR 500,000", 1,
                         np.where(d11["Q15a"] == "INR 500,001 – INR 15,00,000", 2,
                                  np.where(d11["Q15a"] == "INR 1500,001 – INR 30,00,000", 3,
                                           np.where(d11["Q15a"] == "INR 30,00,001 – INR 50,00,000", 4,
                                                    np.where(d11["Q15a"] == "INR 50,00,001 – INR 75,00,000", 5,
                                                             np.where( d11["Q15a"] == "> INR 75,00,000", 5,0
                                                                     )
                                                            )
                                                   )
                                           )
                                  )
                         )

d11["wealth"] = d11["Q14b.1"]

Scoring¶

In [10]:
matchCol = ["q8_2_1", "q8_2_2", "q8_2_3", "q8_2_4", "q8_2_5", "q8_3", "q8_4", "q8_5berlin_1", 
            "q8_5london_1", "q8_5paris_1", "q8_6", "q8_7", "q9_1_1", "q9_2_1", "q9_3",
            "q10_1_1", "q10_2_1", "q10_3_1", "q10_4"]
d11[ matchCol ] = 0

d11.columns
Out[10]:
Index(['ResponseId', 'Q0', 'Q1', 'Q2', 'Q3', 'Q4', 'Q5_1', 'Q6_1', 'Q8_1',
       'Q8_2', 'Q8_3', 'Q8_4', 'Q8_5', 'Q8_6', 'Q8_7', 'Q8_8', 'Q9b_1',
       'Q9b_4', 'Q9b_5', 'Q9b_6', 'Q9b_7', 'Q9b_8', 'Q9b_9', 'Q11a_1',
       'Q11a_2', 'Q11a_3', 'Q11b', 'Q11c', 'Q11d', 'Q11h', 'Attention Check',
       'Q11i', 'Q12a', 'Q12b', 'Q12c', 'Q13a', 'Q13b', 'Q13c', 'Q13d', 'Q14a',
       'Q14b', 'Q14c', 'Q15a', 'Q14b.1', 'age', 'age_rec', 'isced', 'income',
       'wealth', 'q8_2_1', 'q8_2_2', 'q8_2_3', 'q8_2_4', 'q8_2_5', 'q8_3',
       'q8_4', 'q8_5berlin_1', 'q8_5london_1', 'q8_5paris_1', 'q8_6', 'q8_7',
       'q9_1_1', 'q9_2_1', 'q9_3', 'q10_1_1', 'q10_2_1', 'q10_3_1', 'q10_4'],
      dtype='object')
In [11]:
d11["q8_2_1"] = np.where(d11["Q11b"].str.contains("HIV test"), 1, 2)
d11["q8_2_2"] = np.where(d11["Q11b"].str.contains("Fingerprint"), 1, 2)
d11["q8_2_3"] = np.where(d11["Q11b"].str.contains("DNA test"), 1, 2)
d11["q8_2_4"] = np.where(d11["Q11b"].str.contains("Cancer screening test"), 1, 2)
d11["q8_2_5"] = np.where(d11["Q11b"].str.contains("Professional horoscope"), 1, 2)

d11["q8_3"] = np.where(d11["Q11c"] == "The lower the quality of the study, the more likely that future studies will change the risk estimate.", 1,
                          np.where(d11["Q11c"] == "The higher the quality of the study, the more likely that future studies will change the risk estimate.", 2,
                                  np.where(d11["Q11c"] == "Irrespective of the quality of the study, future studies will not change the risk estimate.", 3,
                                          np.where(d11["Q11c"] == "Irrespective of the quality of the study, future studies will change the risk estimate substantially anyway.", 4,0
                                                  )
                                          )
                                  )
                         )


d11["q8_4"] = np.where(d11["Q11d"] == "The growth rate will be 0.4% on average each year", 1,
                          np.where(d11["Q11d"] == "The growth rate over five years will be exactly 2%", 2,
                                  np.where(d11["Q11d"] == "The growth rate over five years will be between 1% and 3%", 3,
                                          np.where(d11["Q11d"] == "It is not possible to predict the growth rate with certainty", 4,0
                                                  )
                                          )
                                  )
                         )
In [12]:
d11["q8_5berlin_1"] = np.where(d11["Q11a_1"] == 1, 1, 2)
d11["q8_5london_1"] = np.where(d11["Q11a_1"] == 1, 1, 2)
d11["q8_5paris_1"] = np.where(d11["Q11a_1"] == 1, 1, 2)

d11["q8_6"] = np.where(d11["Q11i"] == "The medication increases recovery by 100%", 1,
                          np.where(d11["Q11i"] == "The medication increases recovery by 50%", 2,
                                   np.where(d11["Q11i"] == "The medication increases recovery by 2%", 3,
                                            np.where(d11["Q11i"] == "None of the above is implied", 4, 0
                                                    )
                                           )
                                  )
                         )

d11["q8_7"] = np.where(d11["Q11h"] == "5 in 100 people prior to the intervention to 6 out of 100 people after the intervention", 1,
                          np.where(d11["Q11h"] == "100 in 10,000 people prior to the intervention to 120 out of 10,000 people after the intervention", 2,
                                   np.where(d11["Q11h"] == "70 in 100 people prior to the intervention to 90 out of 100 people after the intervention", 3,
                                            np.where(d11["Q11h"] == "It is not possible to determine which of the answers is correct given the information provided", 4, 0
                                                    )
                                           )
                                  )
                         )


d11["q9_1_1"] = d11["Q14a"].copy()
d11["q9_2_1"] = d11["Q14b"].copy()

d11["q9_3"] = np.where(d11["Q14c"] == "Crosicol", 1,
                          np.where(d11["Q14c"] == "Hertinol", 2,
                                   np.where(d11["Q14c"] == "They are equal", 3,
                                            np.where(d11["Q14c"] == "Can’t say", 4, 0
                                                    )
                                           )
                                  )
                         )
In [13]:
d11["q10_1_1"] = d11["Q13a"].copy()
d11["q10_2_1"] = d11["Q13b"].copy()
d11["q10_3_1"] = d11["Q13c"].copy()

d11["q10_4"] = np.where(d11["Q13d"] == "9 out of 59", 1,
                          np.where(d11["Q13d"] == "9 out of 10", 2,
                                   np.where(d11["Q13d"] == "59 out of 1000", 3,
                                            np.where(d11["Q13d"] == "59 out of 100", 4, 0
                                                    )
                                           )
                                  )
                         )
In [14]:
d11["ResponseId"].nunique()
Out[14]:
250
In [15]:
scoreColumns = ["certainty1", "certainty2", "certainty3", "certainty4", "certainty5", "uncertainty1", "uncertainty2", "numeracy1", "numeracy2", "numeracy3", "numeracy4", "numeracy5", "graph1", "graph2", "graph3", "riskcalculation1", "riskcalculation2", "riskcalculation3", "riskcalculation4"]
d11[scoreColumns] = 0
In [16]:
# Assigning scores

def scoring1(d11Facet):
    d11Facet.loc[ d11Facet["q8_2_1"] == 2, "certainty1"] = 1
    d11Facet.loc[ d11Facet["q8_2_2"] == 2, "certainty2"] = 1
    d11Facet.loc[ d11Facet["q8_2_3"] == 2, "certainty3"] = 1
    d11Facet.loc[ d11Facet["q8_2_4"] == 2, "certainty4"] = 1
    d11Facet.loc[ d11Facet["q8_2_5"] == 2, "certainty5"] = 1

    d11Facet.loc[ d11Facet["q8_3"] == 1, "uncertainty1"] = 1
    d11Facet.loc[ d11Facet["q8_4"] == 4, "uncertainty2"] = 1

    d11Facet.loc[ d11Facet["q8_5berlin_1"] == 2, "numeracy1"] = 1
    d11Facet.loc[ d11Facet["q8_5london_1"] == 1, "numeracy2"] = 1
    d11Facet.loc[ d11Facet["q8_5paris_1"] == 1, "numeracy3"] = 1
    d11Facet.loc[ d11Facet["q8_6"] == 1, "numeracy4"] = 1
    d11Facet.loc[ d11Facet["q8_7"] == 4, "numeracy5"] = 1

    d11Facet.loc[ d11Facet["q9_1_1"] == 25, "graph1"] = 1
    d11Facet.loc[ d11Facet["q9_2_1"] == 20, "graph2"] = 1
    d11Facet.loc[ d11Facet["q9_3"] == 3, "graph3"] = 1

    d11Facet.loc[ d11Facet["q10_1_1"] == 500, "riskcalculation1"] = 1
    d11Facet.loc[ d11Facet["q10_2_1"] == 10, "riskcalculation2"] = 1
    d11Facet.loc[ (d11Facet["q10_3_1"] == 0.1) | (d11Facet["q10_3_1"] == ".1") | (d11Facet["q10_3_1"] == ",1") , "riskcalculation3"] = 1
    d11Facet.loc[ d11Facet["q10_4"] == 1, "riskcalculation4"] = 1

    # Assigning total scores
    #d11Facet["Certainty score_5"] = d11Facet["certainty1"] + d11Facet["certainty2"] + d11Facet["certainty3"] + d11Facet["certainty4"] + d11Facet["certainty5"]
    #d11Facet["Uncertainty score_5"] = d11Facet["uncertainty1"] + d11Facet["uncertainty2"]

    #d11Facet["Number Comprehension score_5"] = d11Facet["numeracy1"] + d11Facet["numeracy2"] + d11Facet["numeracy3"] + d11Facet["numeracy4"] + d11Facet["numeracy5"]
    #d11Facet["Graph Comprehension score_5"] = d11Facet["graph1"] + d11Facet["graph2"] + d11Facet["graph3"]

    #d11Facet["Calculation score_4"] = d11Facet["riskcalculation1"] + d11Facet["riskcalculation2"] + d11Facet["riskcalculation3"] + d11Facet["riskcalculation4"]

    #d11Facet["Total Score_19"] = d11Facet["Certainty score_5"] + d11Facet["Uncertainty score_5"] + d11Facet["Number Comprehension score_5"] + d11Facet["Graph Comprehension score_5"] + d11Facet["Calculation score_4"]

    return d11Facet
In [17]:
d11Facet = d11.groupby(["ResponseId"]).progress_apply(scoring1)
100%|███████████████████████████████████████████████████████████████████████████████| 250/250 [00:01<00:00, 160.21it/s]
In [18]:
d11Facet
Out[18]:
ResponseId Q0 Q1 Q2 Q3 Q4 Q5_1 Q6_1 Q8_1 Q8_2 Q8_3 Q8_4 Q8_5 Q8_6 Q8_7 Q8_8 Q9b_1 Q9b_4 Q9b_5 Q9b_6 Q9b_7 Q9b_8 Q9b_9 Q11a_1 Q11a_2 Q11a_3 Q11b Q11c Q11d Q11h Attention Check Q11i Q12a Q12b Q12c Q13a Q13b Q13c Q13d Q14a Q14b Q14c Q15a Q14b.1 age age_rec isced income wealth q8_2_1 q8_2_2 q8_2_3 q8_2_4 q8_2_5 q8_3 q8_4 q8_5berlin_1 q8_5london_1 q8_5paris_1 q8_6 q8_7 q9_1_1 q9_2_1 q9_3 q10_1_1 q10_2_1 q10_3_1 q10_4 certainty1 certainty2 certainty3 certainty4 certainty5 uncertainty1 uncertainty2 numeracy1 numeracy2 numeracy3 numeracy4 numeracy5 graph1 graph2 graph3 riskcalculation1 riskcalculation2 riskcalculation3 riskcalculation4
ResponseId
R_1YkMM2lMB9aEuVL 150 R_1YkMM2lMB9aEuVL Yes, I would like to participate in the study ... Female 41 Undergraduate Program Salaried/Employee/Consultant in a sector other... 3 3 3 4 3 3 3 3 3 4 85.0 0.0 0 0 5.0 10 0.0 1 1 1 DNA test The higher the quality of the study, the more ... The growth rate over five years will be betwee... 5 in 100 people prior to the intervention to 6... Vase The medication increases recovery by 50% Less than $102 Exactly the same as today with the money in th... True 1000 10 1.0 59 out of 1000 9.0 20 Crosicol < INR 500,000 25000.0 41 3 2 1 25000.0 2 2 1 2 2 2 3 1 1 1 2 1 9.0 20 1 1000 10 1.0 3 1 1 0 1 1 0 0 0 1 1 0 0 0 1 0 0 1 0 0
R_40VyTmJ6i96wUP4 235 R_40VyTmJ6i96wUP4 Yes, I would like to participate in the study ... Female 34 Post-Graduate Program Not employed 2 0 (no investment experience) 3 2 2 3 3 3 2 3 40.0 25.0 10 10 15.0 0 0.0 1 2 1 DNA test The higher the quality of the study, the more ... It is not possible to predict the growth rate ... It is not possible to determine which of the a... Vase The medication increases recovery by 2% Refuse to answer Less than today with the money in this account Do not know 698 352 1.0 59 out of 1000 30.0 20 Crosicol < INR 500,000 500000.0 34 2 1 1 500000.0 2 2 1 2 2 2 4 1 1 1 3 4 30.0 20 1 698 352 1.0 3 1 1 0 1 1 0 1 0 1 1 0 1 0 1 0 0 0 0 0
R_40ZEg7vX3Y7mMQl 184 R_40ZEg7vX3Y7mMQl Yes, I would like to participate in the study ... Female 31 Undergraduate Program Not employed 4 6 2 2 2 1 (strongly disagree) 2 3 4 1 (strongly disagree) 30.0 30.0 10 0 20.0 10 0.0 1 1 1 HIV test,Fingerprint,DNA test,Cancer screening... The higher the quality of the study, the more ... The growth rate will be 0.4% on average each year 70 in 100 people prior to the intervention to ... Vase The medication increases recovery by 2% More than $102 Less than today with the money in this account True 500 10 10.0 59 out of 1000 50.0 20 They are equal < INR 500,000 500000.0 31 2 2 1 500000.0 1 1 1 1 2 2 1 1 1 1 3 3 50.0 20 3 500 10 10.0 3 0 0 0 0 1 0 0 0 1 1 0 0 0 1 1 1 1 0 0
R_40cbsHWzTyKyFxv 53 R_40cbsHWzTyKyFxv Yes, I would like to participate in the study ... Male 38 Undergraduate Program Salaried/Employee/Consultant in a sector other... 5 5 4 6 (strongly agree) 5 4 6 (strongly agree) 6 (strongly agree) 6 (strongly agree) 6 (strongly agree) 45.0 35.0 0 5 15.0 0 0.0 2 1 2 Fingerprint The higher the quality of the study, the more ... The growth rate over five years will be exactl... It is not possible to determine which of the a... Vase The medication increases recovery by 2% More than $102 Exactly the same as today with the money in th... False 1000 100 25.0 9 out of 10 30.0 20 They are equal < INR 500,000 300000.0 38 3 2 1 300000.0 2 1 2 2 2 2 2 2 2 2 3 4 30.0 20 3 1000 100 25.0 2 1 0 1 1 1 0 0 1 0 0 0 1 0 1 1 0 0 0 0
R_40xSljq38S8zicV 123 R_40xSljq38S8zicV Yes, I would like to participate in the study ... Male 36 Undergraduate Program Not employed 3 5 6 (strongly agree) 3 6 (strongly agree) 6 (strongly agree) 5 5 5 5 30.0 0.0 40 0 30.0 0 0.0 2 1 1 DNA test The lower the quality of the study, the more l... It is not possible to predict the growth rate ... 5 in 100 people prior to the intervention to 6... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account False 500 10 0.1 9 out of 59 25.0 20 They are equal INR 1500,001 – INR 30,00,000 1000000.0 36 3 2 3 1000000.0 2 2 1 2 2 1 4 2 2 2 1 1 25.0 20 3 500 10 0.1 1 1 1 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
R_4xj4ficLsaoMZm9 138 R_4xj4ficLsaoMZm9 Yes, I would like to participate in the study ... Male 20 Undergraduate Program Salaried/Employee/Consultant in a sector other... 4 1 3 2 4 5 5 4 3 6 (strongly agree) 90.0 0.0 0 0 0.0 10 0.0 2 2 1 HIV test Irrespective of the quality of the study, futu... The growth rate will be 0.4% on average each year 5 in 100 people prior to the intervention to 6... Vase The medication increases recovery by 100% More than $102 Exactly the same as today with the money in th... True 500 5 10.0 9 out of 10 26.0 20 Hertinol INR 30,00,001 – INR 50,00,000 800000.0 20 2 2 4 800000.0 1 2 2 2 2 4 1 2 2 2 1 1 26.0 20 2 500 5 10.0 2 0 1 1 1 1 0 0 1 0 0 1 0 0 1 0 1 0 0 0
R_4ygaLyBv8lHSSf7 75 R_4ygaLyBv8lHSSf7 Yes, I would like to participate in the study ... Male 34 Undergraduate Program Entrepreneur/Business Owner in a sector other ... 4 4 6 (strongly agree) 6 (strongly agree) 6 (strongly agree) 5 6 (strongly agree) 1 (strongly disagree) 6 (strongly agree) 6 (strongly agree) 40.0 10.0 10 10 10.0 10 10.0 1 1 2 Fingerprint The higher the quality of the study, the more ... The growth rate will be 0.4% on average each year 70 in 100 people prior to the intervention to ... Vase The medication increases recovery by 2% More than $102 Less than today with the money in this account Refuse to answer 500 999 100.0 9 out of 59 80.0 20 Hertinol < INR 500,000 500000.0 34 2 2 1 500000.0 2 1 2 2 2 2 1 1 1 1 3 3 80.0 20 2 500 999 100.0 1 1 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 0 0 1
R_4yiENHF5RuMjf3P 318 R_4yiENHF5RuMjf3P Yes, I would like to participate in the study ... Male 42 Post-Graduate Program Salaried/Employee/Consultant in a sector other... 5 5 6 (strongly agree) 5 6 (strongly agree) 5 6 (strongly agree) 5 6 (strongly agree) 6 (strongly agree) 20.0 50.0 0 19 10.0 0 1.0 1 2 2 DNA test The higher the quality of the study, the more ... The growth rate over five years will be betwee... 5 in 100 people prior to the intervention to 6... Vase The medication increases recovery by 2% More than $102 Less than today with the money in this account False 500 10 1.0 9 out of 10 25.0 20 They are equal < INR 500,000 600000.0 42 3 1 1 600000.0 2 2 1 2 2 2 3 1 1 1 3 1 25.0 20 3 500 10 1.0 2 1 1 0 1 1 0 0 0 1 1 0 0 1 1 1 1 1 0 0
R_4zPiSk23ayGvFD4 364 R_4zPiSk23ayGvFD4 Yes, I would like to participate in the study ... Male 70 Undergraduate Program Salaried/Employee/Consultant in a sector other... 4 6 4 4 4 4 5 5 5 4 15.0 20.0 10 0 25.0 30 0.0 2 1 1 DNA test The higher the quality of the study, the more ... It is not possible to predict the growth rate ... It is not possible to determine which of the a... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account False 500 10 1.0 59 out of 1000 25.0 20 Crosicol INR 1500,001 – INR 30,00,000 7000000.0 70 4 2 3 7000000.0 2 2 1 2 2 2 4 2 2 2 1 4 25.0 20 1 500 10 1.0 3 1 1 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 0 0
R_8k6D0jzzHCC5X3Z 369 R_8k6D0jzzHCC5X3Z Yes, I would like to participate in the study ... Male 25 Undergraduate Program Salaried/Employee/Consultant in a sector other... 7 (willing to take risk) 8 6 (strongly agree) 5 5 4 6 (strongly agree) 6 (strongly agree) 6 (strongly agree) 5 5.0 5.0 5 5 30.0 20 30.0 2 1 1 DNA test The higher the quality of the study, the more ... It is not possible to predict the growth rate ... 5 in 100 people prior to the intervention to 6... Vase The medication increases recovery by 100% More than $102 Less than today with the money in this account False 500 500 50.0 59 out of 1000 25.0 10 Hertinol > INR 75,00,000 8000000.0 25 2 2 5 8000000.0 2 2 1 2 2 2 4 2 2 2 1 1 25.0 10 2 500 500 50.0 3 1 1 0 1 1 0 1 1 0 0 1 0 1 0 0 1 0 0 0

250 rows × 87 columns

In [19]:
d11 = d11Facet.copy().reset_index(drop = True)
In [20]:
d11["Certainty_3"] = d11["certainty1"] + d11["certainty2"] + d11["certainty3"]
d11["RiskComprehension_3"] = d11["riskcalculation1"] + d11["riskcalculation2"] + d11["riskcalculation4"]
d11["GraphLiteracy_3"] = d11["graph1"] + d11["graph2"] + d11["graph3"]
d11["Numeracy_3"] = d11["numeracy1"] + d11["numeracy2"] + d11["numeracy3"]
d11["Bayesianreasoning_1"] = d11["numeracy4"]
d11["TotalScore_13"] = d11["Certainty_3"] + d11["RiskComprehension_3"] + d11["GraphLiteracy_3"] + d11["Numeracy_3"] + d11["Bayesianreasoning_1"]

d11["Certainty_%"] = d11["Certainty_3"] / 3 * 100
d11["RiskComprehension_%"] = d11["RiskComprehension_3"] / 4 * 100
d11["GraphLiteracy_%"] = d11["GraphLiteracy_3"] / 3 * 100
d11["Numeracy_%"] = d11["Numeracy_3"] / 3 * 100
d11["Bayesianreasoning_%"] = d11["Bayesianreasoning_1"] / 1 * 100

d11["TotalScore_%"] = d11["TotalScore_13"] / 13 * 100


colReq = ["ResponseId", "age", "age_rec", "isced", "income", "wealth", "Certainty_3", "RiskComprehension_3", "GraphLiteracy_3",
          "Numeracy_3", "Bayesianreasoning_1", "Certainty_%", "RiskComprehension_%", "GraphLiteracy_%", "Numeracy_%", "Bayesianreasoning_%",
          "TotalScore_13", "TotalScore_%",]

d12 = d11[colReq].copy()
d12
Out[20]:
ResponseId age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
0 R_1YkMM2lMB9aEuVL 41 3 2 1 25000.0 2 1 1 2 0 66.666667 25.0 33.333333 66.666667 0.0 6 46.153846
1 R_40VyTmJ6i96wUP4 34 2 1 1 500000.0 2 0 1 2 0 66.666667 0.0 33.333333 66.666667 0.0 5 38.461538
2 R_40ZEg7vX3Y7mMQl 31 2 2 1 500000.0 0 2 2 2 0 0.000000 50.0 66.666667 66.666667 0.0 6 46.153846
3 R_40cbsHWzTyKyFxv 38 3 2 1 300000.0 2 0 2 1 0 66.666667 0.0 66.666667 33.333333 0.0 5 38.461538
4 R_40xSljq38S8zicV 36 3 2 3 1000000.0 2 3 3 1 1 66.666667 75.0 100.000000 33.333333 100.0 10 76.923077
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
245 R_4xj4ficLsaoMZm9 20 2 2 4 800000.0 2 1 1 1 1 66.666667 25.0 33.333333 33.333333 100.0 6 46.153846
246 R_4ygaLyBv8lHSSf7 34 2 2 1 500000.0 2 2 1 2 0 66.666667 50.0 33.333333 66.666667 0.0 7 53.846154
247 R_4yiENHF5RuMjf3P 42 3 1 1 600000.0 2 2 3 2 0 66.666667 50.0 100.000000 66.666667 0.0 9 69.230769
248 R_4zPiSk23ayGvFD4 70 4 2 3 7000000.0 2 2 2 1 1 66.666667 50.0 66.666667 33.333333 100.0 8 61.538462
249 R_8k6D0jzzHCC5X3Z 25 2 2 5 8000000.0 2 1 1 1 1 66.666667 25.0 33.333333 33.333333 100.0 6 46.153846

250 rows × 18 columns

In [21]:
df2 = pd.concat([d01, d12], axis = 0).reset_index(drop = True)
In [22]:
df2
Out[22]:
ResponseId age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
0 00ujdxbfoya0donu8r00ujcjdkojc99x 30.5 2 2 1 1500000.0 0 1 1 2 0 0.000000 25.0 33.333333 66.666667 0.0 4 28.571429
1 022xoawhrghfhv4a1g022xmz7hb0m41f 50.5 3 2 1 15000000.0 0 1 1 2 0 0.000000 25.0 33.333333 66.666667 0.0 4 28.571429
2 02pxtdbyibecqqfvwlw02pxwfbane9zd 50.5 3 1 2 3000000.0 0 0 1 3 0 0.000000 0.0 33.333333 100.000000 0.0 4 28.571429
3 037aefjdt26mnjd102nz0pk037aedfhc 50.5 3 1 2 7000000.0 2 1 1 1 0 66.666667 25.0 33.333333 33.333333 0.0 5 35.714286
4 047u13akxwyg4n0472cel5lo9pqsx9hv 30.5 2 2 2 300000.0 1 1 1 2 0 33.333333 25.0 33.333333 66.666667 0.0 5 35.714286
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
727 R_4xj4ficLsaoMZm9 20.0 2 2 4 800000.0 2 1 1 1 1 66.666667 25.0 33.333333 33.333333 100.0 6 46.153846
728 R_4ygaLyBv8lHSSf7 34.0 2 2 1 500000.0 2 2 1 2 0 66.666667 50.0 33.333333 66.666667 0.0 7 53.846154
729 R_4yiENHF5RuMjf3P 42.0 3 1 1 600000.0 2 2 3 2 0 66.666667 50.0 100.000000 66.666667 0.0 9 69.230769
730 R_4zPiSk23ayGvFD4 70.0 4 2 3 7000000.0 2 2 2 1 1 66.666667 50.0 66.666667 33.333333 100.0 8 61.538462
731 R_8k6D0jzzHCC5X3Z 25.0 2 2 5 8000000.0 2 1 1 1 1 66.666667 25.0 33.333333 33.333333 100.0 6 46.153846

732 rows × 18 columns

In [ ]:
 

GRAPHS¶

In [23]:
# The following graph represents frequency of each data point on "TotalScore_13" or the total score out of 13 questions across the sample.

df2['TotalScore_13'].plot(kind = 'hist', xticks = np.arange(0, 15, step=1), xlabel = 'TotalScore_13', title = 'Frequency of Scores' )
Out[23]:
<Axes: title={'center': 'Frequency of Scores'}, xlabel='TotalScore_13', ylabel='Frequency'>
No description has been provided for this image
In [24]:
# Absolute mean scores for each facet

(df2[['Certainty_3','RiskComprehension_3','GraphLiteracy_3','Numeracy_3','Bayesianreasoning_1','TotalScore_13']].mean(axis = 0)).plot(kind = 'bar', title = 'Absolute mean of scores for above data set')
Out[24]:
<Axes: title={'center': 'Absolute mean of scores for above data set'}>
No description has been provided for this image
In [25]:
# Normalised mean scores for each facet

df2[['Certainty_%','RiskComprehension_%','GraphLiteracy_%','Numeracy_%','Bayesianreasoning_%','TotalScore_%']].mean(axis = 0).plot(kind = 'bar', title = '% mean of scores for above data set')
Out[25]:
<Axes: title={'center': '% mean of scores for above data set'}>
No description has been provided for this image
In [ ]:
 
In [ ]:
 

ISCED¶

In [26]:
# Data Frame 5 or df5 is an aggregate data on facet total scores and over all total score, along with  education data vs each response. 
# This data set is now sorted by education.

df5 = df2.sort_values(by = 'isced')
df5 = df5.reset_index(drop = True)

df5
Out[26]:
ResponseId age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
0 rj2dsp2uel6b8rj2dkibbyuldjm1bh6e 30.5 2 1 3 30000000.0 1 1 1 2 0 33.333333 25.0 33.333333 66.666667 0.0 5 35.714286
1 ok1udp8wderxbit9rok1udnboh1x91ts 30.5 2 1 2 200000.0 0 2 2 3 0 0.000000 50.0 66.666667 100.000000 0.0 7 50.000000
2 R_4QXwwATjB2OAo7O 31.0 2 1 1 400000.0 1 1 0 2 0 33.333333 25.0 0.000000 66.666667 0.0 4 30.769231
3 odfxscnhx6pz1ptrodfxs46gbnyv7ntb 60.5 4 1 2 1250000.0 0 1 2 1 1 0.000000 25.0 66.666667 33.333333 100.0 5 35.714286
4 obftinjncjw2fkari22ghobfti6alubg 30.5 2 1 3 5200000.0 0 1 3 3 0 0.000000 25.0 100.000000 100.000000 0.0 7 50.000000
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
727 R_4qTJDH687CmCJuV 40.0 3 3 3 5000000.0 0 0 0 1 1 0.000000 0.0 0.000000 33.333333 100.0 2 15.384615
728 z9qc7tbbfdojdkoabhww5snz9qc7tbif 50.5 3 3 1 300000.0 0 2 0 1 0 0.000000 50.0 0.000000 33.333333 0.0 3 21.428571
729 a31qwuv5yj3n5tlmea3183d7y7salhcl 30.5 2 3 1 5000000.0 0 1 0 2 0 0.000000 25.0 0.000000 66.666667 0.0 3 21.428571
730 ylqbir1q5isg86n72mvz9jylqbirf512 30.5 2 3 2 50000.0 1 0 0 1 0 33.333333 0.0 0.000000 33.333333 0.0 2 14.285714
731 tljgvfjwoh3aj1i4hdk8wtphtljgjahd 70.5 4 3 1 2500000.0 1 1 3 3 0 33.333333 25.0 100.000000 100.000000 0.0 8 57.142857

732 rows × 18 columns

In [27]:
# Mean of each facet as a % for each category of isced

df5.groupby('isced')[['Certainty_%','RiskComprehension_%','Numeracy_%','GraphLiteracy_%','Bayesianreasoning_%']].mean()
Out[27]:
Certainty_% RiskComprehension_% Numeracy_% GraphLiteracy_% Bayesianreasoning_%
isced
1 27.219430 31.595477 54.941374 43.969849 24.120603
2 32.673267 33.250825 54.125413 45.434543 31.023102
3 37.634409 23.387097 48.387097 32.258065 22.580645
In [28]:
# Count of responses for each category isced

df5.groupby('isced')[['ResponseId']].count()
Out[28]:
ResponseId
isced
1 398
2 303
3 31
In [29]:
# Absolute Total Facet scores mean line plot from low to high ISCED

df5.groupby('isced')[['TotalScore_13']].mean().plot( kind = 'line', title = 'Absolute Total Facet scores mean line plot', xticks = np.arange(1,4, step = 1)).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[29]:
<matplotlib.legend.Legend at 0x2612edf0d10>
No description has been provided for this image
In [30]:
# Absolute Facet scores mean line plot from low to high edu

df5.groupby('isced')[['Certainty_3','RiskComprehension_3','Numeracy_3','GraphLiteracy_3','Bayesianreasoning_1']].mean().plot( kind = 'line', title = 'Absolute Facet scores mean line plot', xticks = np.arange(1,4, step = 1)).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[30]:
<matplotlib.legend.Legend at 0x2612ee76950>
No description has been provided for this image
In [31]:
# Normalised Facet scores mean line plot from low to high edu


df5.groupby('isced')[['Certainty_%','RiskComprehension_%','Numeracy_%','GraphLiteracy_%','Bayesianreasoning_%','TotalScore_%']].mean().plot( kind = 'line', title = 'Normalised Facet scores mean line plot', xticks = np.arange(1,4, step = 1)).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[31]:
<matplotlib.legend.Legend at 0x2612e97f5d0>
No description has been provided for this image
In [32]:
# Normalised mean scores for each facet stacked

df5.groupby('isced')[['Certainty_%','RiskComprehension_%','Numeracy_%','GraphLiteracy_%','Bayesianreasoning_%']].mean().plot( kind = 'bar', title = 'Normalised mean scores for each facet stacked', stacked = True).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[32]:
<matplotlib.legend.Legend at 0x2612f013210>
No description has been provided for this image
In [33]:
# Normalised mean scores for each facet for each edu response category

df5.groupby('isced')[['Certainty_%','RiskComprehension_%','Numeracy_%','GraphLiteracy_%','Bayesianreasoning_%','TotalScore_%']].mean().T.plot(kind = 'bar', title = 'Normalised mean scores for each facet for each edu response category').legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[33]:
<matplotlib.legend.Legend at 0x2612e558e50>
No description has been provided for this image
In [34]:
# Trend line for Absolute Total Facet Score vs edu (isced) reponses

sns.regplot (data = df5, x = 'isced', y = 'TotalScore_13')
Out[34]:
<Axes: xlabel='isced', ylabel='TotalScore_13'>
No description has been provided for this image
In [35]:
# Trend line for Absolute Independent Facet Score vs edu (isced) reponses

fig, ax6 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df5, x = 'isced', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax6, label='Certainty_3')
sns.regplot (data = df5, x = 'isced', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax6, label='RiskComprehension_3')
sns.regplot (data = df5, x = 'isced', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax6, label='Numeracy_3')
sns.regplot (data = df5, x = 'isced', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax6, label='GraphLiteracy_3')
sns.regplot (data = df5, x = 'isced', y = 'Bayesianreasoning_1',fit_reg=True, ci=None, ax=ax6, label='Bayesianreasoning_1' )

ax6.set(ylabel='Scores', xlabel='isced')
ax6.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [36]:
# Violine Plot for TotalScore_13 for each entry under edu.

sns.violinplot( data = df5, x = 'isced', y = 'TotalScore_13')
Out[36]:
<Axes: xlabel='isced', ylabel='TotalScore_13'>
No description has been provided for this image
In [37]:
# Violine Plot for Certainty_3 for each entry under edu.

sns.violinplot( data = df5, x = 'isced', y = 'Certainty_3')
Out[37]:
<Axes: xlabel='isced', ylabel='Certainty_3'>
No description has been provided for this image
In [38]:
# Violine Plot for RiskComprehension_3 for each entry under edu.

sns.violinplot( data = df5, x = 'isced', y = 'RiskComprehension_3')
Out[38]:
<Axes: xlabel='isced', ylabel='RiskComprehension_3'>
No description has been provided for this image
In [39]:
# Violine Plot for GraphLiteracy_3 for each entry under edu.

sns.violinplot( data = df5, x = 'isced', y = 'GraphLiteracy_3')
Out[39]:
<Axes: xlabel='isced', ylabel='GraphLiteracy_3'>
No description has been provided for this image
In [40]:
# Violine Plot for Numeracy_3 for each entry under edu.

sns.violinplot( data = df5, x = 'isced', y = 'Numeracy_3')
Out[40]:
<Axes: xlabel='isced', ylabel='Numeracy_3'>
No description has been provided for this image
In [41]:
# Violine Plot for TotalScore_13 for each entry under edu.

sns.violinplot( data = df5, x = 'isced', y = 'Bayesianreasoning_1')
Out[41]:
<Axes: xlabel='isced', ylabel='Bayesianreasoning_1'>
No description has been provided for this image
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 

INCOME¶

INCOME VS SCORES¶

In [42]:
# DF3 = Sorted by income

df3 = df2.sort_values(by = 'income')
df3 = df3.reset_index(drop = True)
df3.drop(df3[df3['income'] == 7].index, inplace = True)

df3
Out[42]:
ResponseId age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
0 00ujdxbfoya0donu8r00ujcjdkojc99x 30.5 2 2 1 1500000.0 0 1 1 2 0 0.000000 25.0 33.333333 66.666667 0.0 4 28.571429
1 R_4YaC4Cs9ubEg8aR 27.0 2 2 1 300000.0 1 2 3 1 1 33.333333 50.0 100.000000 33.333333 100.0 8 61.538462
2 mm9er7zx3n18o3lmlgmm9erc50lbg3qs 40.5 3 1 1 375000.0 0 2 0 1 0 0.000000 50.0 0.000000 33.333333 0.0 3 21.428571
3 mj52mssq166g3wubcnkmj520tfdzf8oz 40.5 3 3 1 2000.0 1 1 1 2 0 33.333333 25.0 33.333333 66.666667 0.0 5 35.714286
4 R_4axfqmzZmrgJCSh 22.0 2 2 1 5000000.0 2 3 2 1 0 66.666667 75.0 66.666667 33.333333 0.0 8 61.538462
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
727 R_4mtTWcGW77ib4fT 70.0 4 1 5 7465000.0 2 2 0 2 0 66.666667 50.0 0.000000 66.666667 0.0 6 46.153846
728 6zspezg3mbutv7mkarfwbat6zspez1iy 30.5 2 2 5 5000000.0 0 2 2 1 0 0.000000 50.0 66.666667 33.333333 0.0 5 35.714286
729 5pjohovg20dh7j4x5pjohucrvulgs19t 50.5 3 1 5 7500000.0 0 2 0 3 0 0.000000 50.0 0.000000 100.000000 0.0 5 35.714286
730 5n0dsv02wzxwoiof6a8un5n0dsv0oq7w 30.5 2 2 5 2500000.0 0 0 2 2 0 0.000000 0.0 66.666667 66.666667 0.0 4 28.571429
731 R_8k6D0jzzHCC5X3Z 25.0 2 2 5 8000000.0 2 1 1 1 1 66.666667 25.0 33.333333 33.333333 100.0 6 46.153846

732 rows × 18 columns

In [43]:
# Normalised mean of each facet as a numerical (sorted by income)

df3.groupby('income')[['Certainty_%','RiskComprehension_%','GraphLiteracy_%','Numeracy_%','Bayesianreasoning_%','TotalScore_%']].mean()
Out[43]:
Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_%
income
1 38.244048 30.803571 45.238095 52.827381 25.446429 41.642955
2 26.304579 33.306709 45.260916 54.313099 27.156550 39.376119
3 25.816993 32.352941 44.444444 59.150327 28.431373 39.759750
4 24.590164 29.918033 37.704918 52.459016 27.868852 35.660241
5 30.208333 28.906250 35.416667 53.125000 28.125000 36.692995
In [44]:
# Count of responses for each category (sorted by income)

df3.groupby('income')[['ResponseId']].count()
Out[44]:
ResponseId
income
1 224
2 313
3 102
4 61
5 32
In [45]:
# Absolute mean of Total Facet score line plot (sorted by income)

df3.groupby('income')[['TotalScore_13']].mean().plot( kind = 'line', title = 'Absolute mean of Total Facet score line plot (sorted by income)').legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[45]:
<matplotlib.legend.Legend at 0x2612e926c50>
No description has been provided for this image
In [46]:
# Absolute mean of each Facet score line plot (sorted by income)

df3.groupby('income')[['Certainty_3','RiskComprehension_3','GraphLiteracy_3','Numeracy_3','Bayesianreasoning_1']].mean().plot( kind = 'line', title = 'Absolute Facet scores mean line plot').legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[46]:
<matplotlib.legend.Legend at 0x2612ebd5b90>
No description has been provided for this image
In [47]:
# Normalised mean of each Facet score line plot (sorted by income)


df3.groupby('income')[['Certainty_%','RiskComprehension_%','GraphLiteracy_%','Numeracy_%','Bayesianreasoning_%', 'TotalScore_%']].mean().plot( kind = 'line', title = '% mean of each Facet score line plot (sorted by income)').legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[47]:
<matplotlib.legend.Legend at 0x2612ee56ed0>
No description has been provided for this image
In [48]:
# Normalised mean of each Facet score stacked plot (sorted by income)

df3.groupby('income')[['Certainty_%','RiskComprehension_%','GraphLiteracy_%','Numeracy_%','Bayesianreasoning_%']].mean().plot( kind = 'bar', title = '% mean of each Facet score stacked plot (sorted by income)', stacked = True).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[48]:
<matplotlib.legend.Legend at 0x2612dd42b90>
No description has been provided for this image
In [49]:
# Normalised mean of each Facet score hist plot (sorted by income)

df3.groupby('income')[['Certainty_%','RiskComprehension_%','GraphLiteracy_%','Numeracy_%','Bayesianreasoning_%','TotalScore_%']].mean().T.plot(kind = 'bar', title = '% mean scores for each facet for each income response category').legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[49]:
<matplotlib.legend.Legend at 0x2612e0d3650>
No description has been provided for this image
In [50]:
# Trend line for Absolute Total Facet Score vs income

sns.regplot (data = df3, x = 'income', y = 'TotalScore_13')
Out[50]:
<Axes: xlabel='income', ylabel='TotalScore_13'>
No description has been provided for this image
In [51]:
# Trend line for Absolute Independent Facet Score vs income reponses

fig, ax = plt.subplots(figsize=(6, 6))

sns.regplot (data = df3, x = 'income', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax, label='Certainty_3')
sns.regplot (data = df3, x = 'income', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax, label='RiskComprehension_3')
sns.regplot (data = df3, x = 'income', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax, label='Numeracy_3')
sns.regplot (data = df3, x = 'income', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax, label='GraphLiteracy_3')
sns.regplot (data = df3, x = 'income', y = 'Bayesianreasoning_1',fit_reg=True, ci=None, ax=ax, label='Bayesianreasoning_1' )

ax.set(ylabel='Scores', xlabel='income')
ax.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [52]:
# Violin Plot for TotalScore_13 for each entry under income.

sns.violinplot( data = df3, x = 'income', y = 'TotalScore_13')
Out[52]:
<Axes: xlabel='income', ylabel='TotalScore_13'>
No description has been provided for this image
In [53]:
# Violin Plot for Certainty_3 for each entry under income.

sns.violinplot( data = df3, x = 'income', y = 'Certainty_3')
Out[53]:
<Axes: xlabel='income', ylabel='Certainty_3'>
No description has been provided for this image
In [54]:
# Violine Plot for RiskComprehension_3 for each entry under income.

sns.violinplot( data = df3, x = 'income', y = 'RiskComprehension_3')
Out[54]:
<Axes: xlabel='income', ylabel='RiskComprehension_3'>
No description has been provided for this image
In [55]:
# Violine Plot for GraphLiteracy_3 for each entry under income.

sns.violinplot( data = df3, x = 'income', y = 'GraphLiteracy_3')
Out[55]:
<Axes: xlabel='income', ylabel='GraphLiteracy_3'>
No description has been provided for this image
In [56]:
# Violine Plot for Numeracy_3 for each entry under income.

sns.violinplot( data = df3, x = 'income', y = 'Numeracy_3')
Out[56]:
<Axes: xlabel='income', ylabel='Numeracy_3'>
No description has been provided for this image
In [57]:
# Violine Plot for TotalScore_13 for each entry under income.

sns.violinplot( data = df3, x = 'income', y = 'Bayesianreasoning_1')
Out[57]:
<Axes: xlabel='income', ylabel='Bayesianreasoning_1'>
No description has been provided for this image
In [ ]:
 
In [ ]:
 

INCOME vs SCORES w/ ISCED classification¶

In [58]:
# Descriptive stats for the data set, isced = 1
# NA values of income are removed

df7 = df5
df7.drop(df7[df7['income'] == 7].index, inplace = True)

df7.loc[df7['isced']==1].describe()
Out[58]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
count 398.000000 398.000000 398.0 398.000000 3.980000e+02 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000
mean 35.707286 2.459799 1.0 2.339196 1.054044e+07 0.816583 1.263819 1.319095 1.648241 0.241206 27.219430 31.595477 43.969849 54.941374 24.120603 5.288945 38.678282
std 9.743647 0.587135 0.0 1.084826 3.861003e+07 0.862908 0.865369 0.958161 0.909997 0.428353 28.763614 21.634232 31.938704 30.333244 42.835348 2.072837 15.401241
min 20.000000 2.000000 1.0 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 7.142857
25% 30.500000 2.000000 1.0 2.000000 3.500000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429
50% 30.500000 2.000000 1.0 2.000000 1.200000e+06 1.000000 1.000000 1.000000 2.000000 0.000000 33.333333 25.000000 33.333333 66.666667 0.000000 5.000000 38.461538
75% 40.500000 3.000000 1.0 3.000000 6.000000e+06 2.000000 2.000000 2.000000 2.000000 0.000000 66.666667 50.000000 66.666667 66.666667 0.000000 7.000000 50.000000
max 70.500000 4.000000 1.0 5.000000 5.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 10.000000 76.923077
In [59]:
df7.loc[df7['isced']==2].describe()
Out[59]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
count 303.000000 303.000000 303.0 303.000000 3.030000e+02 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000
mean 32.826733 2.326733 2.0 1.914191 9.678278e+06 0.980198 1.330033 1.363036 1.623762 0.310231 32.673267 33.250825 45.434543 54.125413 31.023102 5.607261 41.549704
std 9.875492 0.547884 0.0 1.002924 4.966394e+07 0.909627 0.964600 0.969854 0.791321 0.463353 30.320898 24.114993 32.328452 26.377357 46.335333 2.140947 16.277837
min 19.000000 2.000000 2.0 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 26.000000 2.000000 2.0 1.000000 3.000000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429
50% 30.500000 2.000000 2.0 2.000000 8.000000e+05 1.000000 1.000000 1.000000 2.000000 0.000000 33.333333 25.000000 33.333333 66.666667 0.000000 5.000000 38.461538
75% 40.500000 3.000000 2.0 2.000000 4.250000e+06 2.000000 2.000000 2.000000 2.000000 1.000000 66.666667 50.000000 66.666667 66.666667 100.000000 7.000000 53.846154
max 70.000000 4.000000 2.0 5.000000 6.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 11.000000 84.615385
In [60]:
df7.loc[df7['isced']==3].describe()
Out[60]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
count 31.000000 31.000000 31.0 31.000000 3.100000e+01 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000
mean 34.483871 2.451613 3.0 1.580645 2.248115e+06 1.129032 0.935484 0.967742 1.451613 0.225806 37.634409 23.387097 32.258065 48.387097 22.580645 4.709677 34.650833
std 13.560656 0.767624 0.0 1.057487 5.935955e+06 0.921663 0.679975 1.048296 0.994609 0.425024 30.722094 16.999367 34.943204 33.153638 42.502372 2.268532 16.671659
min 16.000000 0.000000 3.0 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 22.750000 2.000000 3.0 1.000000 3.250000e+04 0.000000 0.500000 0.000000 1.000000 0.000000 0.000000 12.500000 0.000000 33.333333 0.000000 3.000000 21.428571
50% 30.500000 2.000000 3.0 1.000000 2.000000e+05 1.000000 1.000000 1.000000 1.000000 0.000000 33.333333 25.000000 33.333333 33.333333 0.000000 5.000000 35.714286
75% 40.500000 3.000000 3.0 2.000000 1.050250e+06 2.000000 1.000000 2.000000 2.000000 0.000000 66.666667 25.000000 66.666667 66.666667 0.000000 6.000000 46.153846
max 70.500000 4.000000 3.0 5.000000 3.000000e+07 3.000000 2.000000 3.000000 3.000000 1.000000 100.000000 50.000000 100.000000 100.000000 100.000000 9.000000 64.285714
In [61]:
# Trend line for Absolute Tota Facet Score vs income reponses sorted by isced and ORDERED by income WITH scatter

fig, ax7 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df7.loc[df7['isced']==1].reset_index(drop = True), x = 'income', y = df7.loc[df7['isced']==1]['TotalScore_13'], fit_reg=True, ci=None, ax=ax7, label='ISCED = 1')
sns.regplot (data = df7.loc[df7['isced']==2].reset_index(drop = True), x = 'income', y = df7.loc[df7['isced']==2]['TotalScore_13'], fit_reg=True, ci=None, ax=ax7, label='ISCED = 2')
sns.regplot (data = df7.loc[df7['isced']==3].reset_index(drop = True), x = 'income', y = df7.loc[df7['isced']==3]['TotalScore_13'], fit_reg=True, ci=None, ax=ax7, label='ISCED = 3')

ax7.set(ylabel='Total Scores_19', xlabel='INCOME')
ax7.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [62]:
# Trend line for Absolute Tota Facet Score vs income reponses sorted by isced and ORDERED by income WITHOUT scatter

fig, ax8 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[df7['isced']==1].reset_index(drop = True), x = 'income', y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==2].reset_index(drop = True), x = 'income', y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==3].reset_index(drop = True), x = 'income', y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 3')

ax8.set(ylabel='Total Scores_19', xlabel='INCOME')
ax8.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [63]:
# Trend line for Absolute Certainty Score vs income reponses sorted by isced and ORDERED by income WITHOUT scatter

fig, ax9 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[df7['isced']==1].reset_index(drop = True), x = 'income', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==2].reset_index(drop = True), x = 'income', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==3].reset_index(drop = True), x = 'income', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 3')

ax9.set(ylabel='Certainty_3', xlabel='INCOME')
ax9.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [64]:
# Trend line for Absolute Risk Comprehension Score vs income reponses sorted by isced and ORDERED by income WITHOUT scatter

fig, ax10 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[df7['isced']==1].reset_index(drop = True), x = 'income', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==2].reset_index(drop = True), x = 'income', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==3].reset_index(drop = True), x = 'income', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 3')

ax10.set(ylabel='RiskComprehension_3', xlabel='INCOME')
ax10.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [65]:
# Trend line for Absolute Number Comprehension Score vs income reponses sorted by isced and ORDERED by income WITHOUT scatter

fig, ax11 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[df7['isced']==1].reset_index(drop = True), x = 'income', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==2].reset_index(drop = True), x = 'income', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==3].reset_index(drop = True), x = 'income', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 3')

ax11.set(ylabel='Numeracy_3', xlabel='INCOME')
ax11.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [66]:
# Trend line for Absolute Graph Comprehension Score vs income reponses sorted by isced and ORDERED by income WITHOUT scatter

fig, ax11 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[df7['isced']==1].reset_index(drop = True), x = 'income', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==2].reset_index(drop = True), x = 'income', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==3].reset_index(drop = True), x = 'income', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 3')

ax11.set(ylabel='GraphLiteracy_3', xlabel='INCOME')
ax11.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [67]:
# Trend line for Absolute Bayesian Reasoning Score vs income reponses sorted by isced and ORDERED by income WITHOUT scatter

fig, ax12 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[df7['isced']==1].reset_index(drop = True), x = 'income', y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==2].reset_index(drop = True), x = 'income', y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[df7['isced']==3].reset_index(drop = True), x = 'income', y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 3')

ax12.set(ylabel='Bayesianreasoning_1', xlabel='INCOME')
ax12.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [ ]:
 
In [ ]:
 

INCOME vs SCORES w/ ISCED and AGE based classification¶

In [68]:
df7
Out[68]:
ResponseId age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
0 rj2dsp2uel6b8rj2dkibbyuldjm1bh6e 30.5 2 1 3 30000000.0 1 1 1 2 0 33.333333 25.0 33.333333 66.666667 0.0 5 35.714286
1 ok1udp8wderxbit9rok1udnboh1x91ts 30.5 2 1 2 200000.0 0 2 2 3 0 0.000000 50.0 66.666667 100.000000 0.0 7 50.000000
2 R_4QXwwATjB2OAo7O 31.0 2 1 1 400000.0 1 1 0 2 0 33.333333 25.0 0.000000 66.666667 0.0 4 30.769231
3 odfxscnhx6pz1ptrodfxs46gbnyv7ntb 60.5 4 1 2 1250000.0 0 1 2 1 1 0.000000 25.0 66.666667 33.333333 100.0 5 35.714286
4 obftinjncjw2fkari22ghobfti6alubg 30.5 2 1 3 5200000.0 0 1 3 3 0 0.000000 25.0 100.000000 100.000000 0.0 7 50.000000
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
727 R_4qTJDH687CmCJuV 40.0 3 3 3 5000000.0 0 0 0 1 1 0.000000 0.0 0.000000 33.333333 100.0 2 15.384615
728 z9qc7tbbfdojdkoabhww5snz9qc7tbif 50.5 3 3 1 300000.0 0 2 0 1 0 0.000000 50.0 0.000000 33.333333 0.0 3 21.428571
729 a31qwuv5yj3n5tlmea3183d7y7salhcl 30.5 2 3 1 5000000.0 0 1 0 2 0 0.000000 25.0 0.000000 66.666667 0.0 3 21.428571
730 ylqbir1q5isg86n72mvz9jylqbirf512 30.5 2 3 2 50000.0 1 0 0 1 0 33.333333 0.0 0.000000 33.333333 0.0 2 14.285714
731 tljgvfjwoh3aj1i4hdk8wtphtljgjahd 70.5 4 3 1 2500000.0 1 1 3 3 0 33.333333 25.0 100.000000 100.000000 0.0 8 57.142857

732 rows × 18 columns

In [69]:
# Since we already have a classification for Age groups in the form of age_rec, we will use that.
# We will also use median of age to see if it yields any relevant results, as instructed.

# AXES to be used = Age or age groups, ISCED, Income

# Age groups = [2,3,4]
# Age group 2 = 18 to 35 y/o
# Age group 3 = 36 to 59 y/o
# Age group 4 = 60 to 75 y/o (75 y/o, i.e, within the scope of the data we have, it can mean 60 and above also)
In [70]:
df7.loc[(df7['age_rec']==2)].describe()
Out[70]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
count 466.000000 466.0 466.000000 466.000000 4.660000e+02 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000
mean 28.287554 2.0 1.532189 2.042918 7.569898e+06 0.907725 1.291845 1.328326 1.609442 0.263948 30.257511 32.296137 44.277539 53.648069 26.394850 5.401288 39.912984
std 3.834470 0.0 0.564195 1.021428 3.143664e+07 0.898065 0.927836 0.960249 0.848678 0.441245 29.935502 23.195899 32.008291 28.289274 44.124539 2.094519 15.865633
min 19.000000 2.0 1.000000 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 25.000000 2.0 1.000000 1.000000 3.000000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429
50% 30.500000 2.0 1.000000 2.000000 8.999995e+05 1.000000 1.000000 1.000000 1.000000 0.000000 33.333333 25.000000 33.333333 33.333333 0.000000 5.000000 38.461538
75% 30.500000 2.0 2.000000 2.000000 3.425000e+06 2.000000 2.000000 2.000000 2.000000 1.000000 66.666667 50.000000 66.666667 66.666667 100.000000 7.000000 50.000000
max 35.000000 2.0 3.000000 5.000000 5.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 11.000000 84.615385
In [71]:
df7.loc[(df7['age_rec']==3)].describe()
Out[71]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
count 232.000000 232.0 232.000000 232.000000 2.320000e+02 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000
mean 42.892241 3.0 1.426724 2.306034 1.445481e+07 0.875000 1.245690 1.284483 1.655172 0.280172 29.166667 31.142241 42.816092 55.172414 28.017241 5.340517 38.961254
std 4.753812 0.0 0.591258 1.138221 6.124404e+07 0.881201 0.875337 0.987419 0.898324 0.450054 29.373366 21.883428 32.913966 29.944135 45.005432 2.182277 16.150284
min 36.000000 3.0 1.000000 1.000000 3.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 40.500000 3.0 1.000000 1.750000 3.000000e+05 0.000000 1.000000 0.000000 1.000000 0.000000 0.000000 25.000000 0.000000 33.333333 0.000000 4.000000 28.571429
50% 40.500000 3.0 1.000000 2.000000 1.750000e+06 1.000000 1.000000 1.000000 2.000000 0.000000 33.333333 25.000000 33.333333 66.666667 0.000000 5.000000 37.087912
75% 46.500000 3.0 2.000000 3.000000 7.500000e+06 2.000000 2.000000 2.000000 2.000000 1.000000 66.666667 50.000000 66.666667 66.666667 100.000000 7.000000 50.000000
max 54.000000 3.0 3.000000 5.000000 6.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 10.000000 76.923077
In [72]:
df7.loc[(df7['age_rec']==4)].describe()
Out[72]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
count 33.000000 33.0 33.000000 33.000000 3.300000e+01 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000
mean 62.969697 4.0 1.484848 2.181818 9.582270e+06 0.848485 1.303030 1.545455 1.727273 0.272727 28.282828 32.575758 51.515152 57.575758 27.272727 5.696970 41.608392
std 4.390934 0.0 0.618527 1.236288 1.406214e+07 0.755034 0.769937 0.938446 0.910794 0.452267 25.167787 19.248426 31.281550 30.359795 45.226702 2.038456 14.956308
min 57.000000 4.0 1.000000 1.000000 1.000000e+05 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 2.000000 14.285714
25% 60.500000 4.0 1.000000 1.000000 1.250000e+06 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429
50% 60.500000 4.0 1.000000 2.000000 5.000000e+06 1.000000 1.000000 2.000000 2.000000 0.000000 33.333333 25.000000 66.666667 66.666667 0.000000 6.000000 42.857143
75% 65.000000 4.0 2.000000 2.000000 1.000000e+07 1.000000 2.000000 2.000000 2.000000 1.000000 33.333333 50.000000 66.666667 66.666667 100.000000 8.000000 57.142857
max 70.500000 4.0 3.000000 5.000000 5.250000e+07 2.000000 3.000000 3.000000 3.000000 1.000000 66.666667 75.000000 100.000000 100.000000 100.000000 9.000000 64.285714
In [ ]:
 
In [73]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (data = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (data = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Total Scores_14', xlabel='INCOME for age 18 to 35')
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (data = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (data = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Total Scores_14', xlabel='INCOME for age 36 to 55')
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (data = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (data = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Total Scores_14', xlabel='INCOME for age 56 and above')
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [74]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df7.loc[ df7['age_rec']==2  ]["income"].unique(), y = df7.loc[ df7['age_rec']==2  ].groupby(['income']).mean(numeric_only=True)['TotalScore_13'], yerr = df7.loc[ (df7['age_rec']==2) ].groupby(['income'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Total Scores_14', xlabel='INCOME for age 18 to 35',  yticks = np.arange(5, 16 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Total Scores_14', xlabel='INCOME for age 36 to 55',  yticks = np.arange(5, 16 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df7.loc[ df7['age_rec']==3  ]["income"].unique(), y = df7.loc[ df7['age_rec']==3  ].groupby(['income']).mean(numeric_only=True)['TotalScore_13'], yerr = df7.loc[ (df7['age_rec']==3) ].groupby(['income'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Total Scores_14', xlabel='INCOME for age 56 and above',  yticks = np.arange(5, 16 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df7.loc[ df7['age_rec']== 4 ]['income'].unique(), y = df7.loc[ df7['age_rec']==4  ].groupby(['income']).mean(numeric_only=True)['TotalScore_13'], yerr = df7.loc[ (df7['age_rec']==4) ].groupby(['income'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [75]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Certainty_3', xlabel='INCOME for age 18 to 35',  yticks = np.arange(0, 6 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df7.loc[ df7['age_rec']==2  ]["income"].unique(), y = df7.loc[ df7['age_rec']==2  ].groupby(['income'])['Certainty_3'].mean(), yerr = df7.loc[ (df7['age_rec']==2) ].groupby(['income'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Certainty_3', xlabel='INCOME for age 36 to 55',  yticks = np.arange(0, 6 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df7.loc[ df7['age_rec']==3  ]["income"].unique(), y = df7.loc[ df7['age_rec']==3  ].groupby(['income'])['Certainty_3'].mean(), yerr = df7.loc[ (df7['age_rec']==3) ].groupby(['income'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Certainty_3', xlabel='INCOME for age 56 and above',  yticks = np.arange(0, 6 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df7.loc[ df7['age_rec']== 4 ]['income'].unique(), y = df7.loc[ df7['age_rec']==4  ].groupby(['income'])['Certainty_3'].mean(), yerr = df7.loc[ (df7['age_rec']==4) ].groupby(['income'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [76]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='RiskComprehension_3', xlabel='INCOME for age 18 to 35',  yticks = np.arange(0, 3 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df7.loc[ df7['age_rec']==2  ]["income"].unique(), y = df7.loc[ df7['age_rec']==2  ].groupby(['income'])['RiskComprehension_3'].mean(), yerr = df7.loc[ (df7['age_rec']==2) ].groupby(['income'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='RiskComprehension_3', xlabel='INCOME for age 36 to 55',  yticks = np.arange(0, 3 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df7.loc[ df7['age_rec']==3  ]["income"].unique(), y = df7.loc[ df7['age_rec']==3  ].groupby(['income'])['RiskComprehension_3'].mean(), yerr = df7.loc[ (df7['age_rec']==3) ].groupby(['income'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='RiskComprehension_3', xlabel='INCOME for age 56 and above',  yticks = np.arange(0, 3 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df7.loc[ df7['age_rec']== 4 ]['income'].unique(), y = df7.loc[ df7['age_rec']==4  ].groupby(['income'])['RiskComprehension_3'].mean(), yerr = df7.loc[ (df7['age_rec']==4) ].groupby(['income'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [77]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Numeracy_3', xlabel='INCOME for age 18 to 35',  yticks = np.arange(0, 6 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df7.loc[ df7['age_rec']==2  ]["income"].unique(), y = df7.loc[ df7['age_rec']==2  ].groupby(['income'])['Numeracy_3'].mean(), yerr = df7.loc[ (df7['age_rec']==2) ].groupby(['income'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Numeracy_3', xlabel='INCOME for age 36 to 55',  yticks = np.arange(0, 6 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df7.loc[ df7['age_rec']==3  ]["income"].unique(), y = df7.loc[ df7['age_rec']==3  ].groupby(['income'])['Numeracy_3'].mean(), yerr = df7.loc[ (df7['age_rec']==3) ].groupby(['income'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Numeracy_3', xlabel='INCOME for age 56 and above',  yticks = np.arange(0, 6 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df7.loc[ df7['age_rec']== 4 ]['income'].unique(), y = df7.loc[ df7['age_rec']==4  ].groupby(['income'])['Numeracy_3'].mean(), yerr = df7.loc[ (df7['age_rec']==4) ].groupby(['income'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [78]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='GraphLiteracy_3', xlabel='INCOME for age 18 to 35',  yticks = np.arange(0, 4 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df7.loc[ df7['age_rec']==2  ]["income"].unique(), y = df7.loc[ df7['age_rec']==2  ].groupby(['income'])['GraphLiteracy_3'].mean(), yerr = df7.loc[ (df7['age_rec']==2) ].groupby(['income'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='GraphLiteracy_3', xlabel='INCOME for age 36 to 55',  yticks = np.arange(0, 4 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df7.loc[ df7['age_rec']==3  ]["income"].unique(), y = df7.loc[ df7['age_rec']==3  ].groupby(['income'])['GraphLiteracy_3'].mean(), yerr = df7.loc[ (df7['age_rec']==3) ].groupby(['income'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='GraphLiteracy_3', xlabel='INCOME for age 56 and above',  yticks = np.arange(0, 4 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df7.loc[ df7['age_rec']== 4 ]['income'].unique(), y = df7.loc[ df7['age_rec']==4  ].groupby(['income'])['GraphLiteracy_3'].mean(), yerr = df7.loc[ (df7['age_rec']==4) ].groupby(['income'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [79]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==2) & (df7['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Bayesianreasoning_1', xlabel='INCOME for age 18 to 35',  yticks = np.arange(0, 5 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df7.loc[ df7['age_rec']==2  ]["income"].unique(), y = df7.loc[ df7['age_rec']==2  ].groupby(['income'])['Bayesianreasoning_1'].mean(), yerr = df7.loc[ (df7['age_rec']==2) ].groupby(['income'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==3) & (df7['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Bayesianreasoning_1', xlabel='INCOME for age 36 to ',  yticks = np.arange(0, 5 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df7.loc[ df7['age_rec']==3  ]["income"].unique(), y = df7.loc[ df7['age_rec']==3  ].groupby(['income'])['Bayesianreasoning_1'].mean(), yerr = df7.loc[ (df7['age_rec']==3) ].groupby(['income'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age_rec']==4) & (df7['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Bayesianreasoning_1', xlabel='INCOME for age 56 and above',  yticks = np.arange(0, 5 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df7.loc[ df7['age_rec']== 4 ]['income'].unique(), y = df7.loc[ df7['age_rec']==4  ].groupby(['income'])['Bayesianreasoning_1'].mean(), yerr = df7.loc[ (df7['age_rec']==4) ].groupby(['income'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [80]:
# Age mean method
# Age_mean
In [81]:
age_m = df2["age"].median()
age_m
Out[81]:
30.5
In [ ]:
 
In [82]:
df7["income"].value_counts()
Out[82]:
income
2    313
1    224
3    102
4     61
5     32
Name: count, dtype: int64
In [83]:
df7.loc[(df7['age'] < age_m)].describe()
Out[83]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
count 193.000000 193.000000 193.000000 193.000000 1.930000e+02 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000
mean 24.455959 1.989637 1.715026 1.911917 9.658172e+06 1.202073 1.404145 1.409326 1.512953 0.331606 40.069085 35.103627 46.977547 50.431779 33.160622 5.860104 44.189489
std 3.143177 0.143963 0.574304 1.034566 4.517310e+07 0.927360 0.925554 0.970028 0.736750 0.472015 30.911984 23.138839 32.334265 24.558323 47.201475 2.024875 15.528721
min 16.000000 0.000000 1.000000 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 7.142857
25% 21.500000 2.000000 1.000000 1.000000 2.000000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 5.000000 35.714286
50% 24.000000 2.000000 2.000000 2.000000 5.000000e+05 1.000000 1.000000 1.000000 1.000000 0.000000 33.333333 25.000000 33.333333 33.333333 0.000000 6.000000 46.153846
75% 27.000000 2.000000 2.000000 2.000000 2.500000e+06 2.000000 2.000000 2.000000 2.000000 1.000000 66.666667 50.000000 66.666667 66.666667 100.000000 7.000000 53.846154
max 30.000000 2.000000 3.000000 5.000000 5.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 11.000000 84.615385
In [84]:
df7.loc[(df7['age'] >= age_m)].describe()
Out[84]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_%
count 539.000000 539.000000 539.000000 539.000000 5.390000e+02 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000
mean 38.046382 2.552876 1.421150 2.209647 9.894761e+06 0.788497 1.231911 1.291280 1.671614 0.246753 26.283241 30.797774 43.042672 55.720470 24.675325 5.230056 38.087423
std 9.240924 0.608556 0.561131 1.079816 4.197602e+07 0.849107 0.891942 0.967184 0.905247 0.431522 28.303566 22.298539 32.239456 30.174889 43.152237 2.126778 15.733497
min 30.500000 2.000000 1.000000 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 30.500000 2.000000 1.000000 1.000000 3.000000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429
50% 35.000000 2.000000 1.000000 2.000000 1.200000e+06 1.000000 1.000000 1.000000 2.000000 0.000000 33.333333 25.000000 33.333333 66.666667 0.000000 5.000000 35.714286
75% 40.500000 3.000000 2.000000 3.000000 5.000000e+06 1.000000 2.000000 2.000000 2.000000 0.000000 33.333333 50.000000 66.666667 66.666667 0.000000 7.000000 50.000000
max 70.500000 4.000000 3.000000 5.000000 6.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 10.000000 76.923077
In [85]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (data = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (data = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Total Scores_19', xlabel='INCOME for < median age')
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df7.loc[(df7['age'] >= age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Total Scores_19', xlabel='INCOME for >=median age')
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [86]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df7.loc[ (df7['age'] < age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] < age_m)  ].groupby(['income'])['TotalScore_13'].mean(), yerr = df7.loc[ (df7['age'] < age_m) ].groupby(['income'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Total Scores_19', xlabel='INCOME for < median age',  yticks = np.arange(5, 16 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df7.loc[ (df7['age'] >= age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] >=age_m)  ].groupby(['income'])['TotalScore_13'].mean(), yerr = df7.loc[ (df7['age'] >=age_m) ].groupby(['income'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='Total Scores_19', xlabel='INCOME for >=median age',  yticks = np.arange(5, 16 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [87]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df7.loc[ (df7['age'] < age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] < age_m)  ].groupby(['income'])['Certainty_3'].mean(), yerr = df7.loc[ (df7['age'] < age_m) ].groupby(['income'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Certainty_3', xlabel='INCOME for < median age',  yticks = np.arange(0, 6 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df7.loc[ (df7['age'] >= age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] >=age_m)  ].groupby(['income'])['Certainty_3'].mean(), yerr = df7.loc[ (df7['age'] >=age_m) ].groupby(['income'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='Certainty_3', xlabel='INCOME for >=median age')
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [88]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df7.loc[ (df7['age'] < age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] < age_m)  ].groupby(['income'])['RiskComprehension_3'].mean(), yerr = df7.loc[ (df7['age'] < age_m) ].groupby(['income'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='RiskComprehension_3', xlabel='INCOME for < median age',  yticks = np.arange(0, 3 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df7.loc[ (df7['age'] >= age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] >=age_m)  ].groupby(['income'])['RiskComprehension_3'].mean(), yerr = df7.loc[ (df7['age'] >=age_m) ].groupby(['income'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='RiskComprehension_3', xlabel='INCOME for >=median age',  yticks = np.arange(0, 3 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [89]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df7.loc[ (df7['age'] < age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] < age_m)  ].groupby(['income'])['Numeracy_3'].mean(), yerr = df7.loc[ (df7['age'] < age_m) ].groupby(['income'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Numeracy_3', xlabel='INCOME for < median age',  yticks = np.arange(0, 6 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df7.loc[ (df7['age'] >= age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] >=age_m)  ].groupby(['income'])['Numeracy_3'].mean(), yerr = df7.loc[ (df7['age'] >=age_m) ].groupby(['income'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='Numeracy_3', xlabel='INCOME for >=median age',  yticks = np.arange(0, 6 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [90]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df7.loc[ (df7['age'] < age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] < age_m)  ].groupby(['income'])['GraphLiteracy_3'].mean(), yerr = df7.loc[ (df7['age'] < age_m) ].groupby(['income'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='GraphLiteracy_3', xlabel='INCOME for < median age',  yticks = np.arange(0, 4 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df7.loc[ (df7['age'] >= age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] >=age_m)  ].groupby(['income'])['GraphLiteracy_3'].mean(), yerr = df7.loc[ (df7['age'] >=age_m) ].groupby(['income'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='GraphLiteracy_3', xlabel='INCOME for >=median age',  yticks = np.arange(0, 4 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [91]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] < age_m) & (df7['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df7.loc[ (df7['age'] < age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] < age_m)  ].groupby(['income'])['Bayesianreasoning_1'].mean(), yerr = df7.loc[ (df7['age'] < age_m) ].groupby(['income'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Bayesianreasoning_1', xlabel='INCOME for < median age',  yticks = np.arange(0, 5 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)].reset_index(drop = True), x = 'income', y = df7.loc[(df7['age'] >=age_m) & (df7['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df7.loc[ (df7['age'] >= age_m)  ]["income"].unique(), y = df7.loc[ (df7['age'] >=age_m)  ].groupby(['income'])['Bayesianreasoning_1'].mean(), yerr = df7.loc[ (df7['age'] >=age_m) ].groupby(['income'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='Bayesianreasoning_1', xlabel='INCOME for >=median age',  yticks = np.arange(0, 5 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 

WEALTH¶

In [92]:
# Data Frame 2 or df2 is an aggregate data on facet total scores and over all total score, along with wealth and income data vs each response. 
# This data set is also sorted by wealth with all responses 'NA' removed.
# We also assign quartiles ranking each response according to this sort.

df4 = df2.sort_values(by = 'wealth')
df4 = df4.reset_index(drop = True)
df4 = df4.dropna(axis = 0, subset = 'wealth')
df4.insert(loc = len(df4.columns), column = "Quartile Number", value = pd.qcut(df4["wealth"],q = 4, labels = False ) + 1, allow_duplicates = 'False')

df4
Out[92]:
ResponseId age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
0 R_4fNO2Z5GF8KerZI 24.0 2 2 2 0.0 3 2 1 2 1 100.000000 50.0 33.333333 66.666667 100.0 9 69.230769 1
1 e7ty2tbwa1hcmte7ty683aw64pla7689 30.5 2 2 1 0.0 0 1 1 1 0 0.000000 25.0 33.333333 33.333333 0.0 3 21.428571 1
2 R_4lnmGavSf6rw1eE 31.0 2 1 1 0.0 0 2 1 1 0 0.000000 50.0 33.333333 33.333333 0.0 4 30.769231 1
3 R_4MJAzsNYYA69Y8p 27.0 2 3 1 0.0 2 1 1 2 1 66.666667 25.0 33.333333 66.666667 100.0 7 53.846154 1
4 R_41bfnamM0zpH94i 30.0 2 1 2 0.0 2 2 1 1 1 66.666667 50.0 33.333333 33.333333 100.0 7 53.846154 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
727 ss5olpa7actdndl6gbkfpvss5olp2jex 21.5 2 2 4 300000000.0 0 2 2 1 0 0.000000 50.0 66.666667 33.333333 0.0 5 35.714286 4
728 lmoqk1qcf44jqqudwkplmoqk18cao0fs 40.5 3 1 2 400000000.0 1 1 1 1 0 33.333333 25.0 33.333333 33.333333 0.0 4 28.571429 4
729 35zux4sc18rplyz3dc85z35zux4sdfm4 21.5 2 2 4 500000000.0 1 1 0 1 0 33.333333 25.0 0.000000 33.333333 0.0 3 21.428571 4
730 wn9mk6m1k8o10l1twn9mk6b4z7l7yvhc 50.5 3 1 3 500000000.0 1 2 3 3 0 33.333333 50.0 100.000000 100.000000 0.0 9 64.285714 4
731 zcj7ldokhyo6217f9sriwizcj7ldodwt 40.5 3 2 3 600000000.0 1 3 1 1 0 33.333333 75.0 33.333333 33.333333 0.0 6 42.857143 4

732 rows × 19 columns

In [93]:
# Trend line for Absolute Total Facet Score vs unique wealth reponses

sns.regplot (data = df4, x = df4.index, y = 'TotalScore_13')
Out[93]:
<Axes: ylabel='TotalScore_13'>
No description has been provided for this image
In [94]:
# Trend line for Absolute Independent Facet Score vs wealth reponses

fig1, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df4, x = df4.index, y = 'Certainty_3', fit_reg=True, ci=None, ax=ax1, label='Certainty_3')
sns.regplot (data = df4, x = df4.index, y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax1, label='RiskComprehension_3')
sns.regplot (data = df4, x = df4.index, y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax1, label='Numeracy_3')
sns.regplot (data = df4, x = df4.index, y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax1, label='GraphLiteracy_3')
sns.regplot (data = df4, x = df4.index, y = 'Bayesianreasoning_1',fit_reg=True, ci=None, ax=ax1, label='Bayesianreasoning_1' )

ax1.set(ylabel='Scores', xlabel='wealth')
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [95]:
# Count of number of responses under each quartile

df4.groupby('Quartile Number')[['Quartile Number']].count()
Out[95]:
Quartile Number
Quartile Number
1 201
2 190
3 182
4 159
In [ ]:
 
In [96]:
# Absolute Total Facet scores mean line plot from low to high Wealth

df4.groupby('Quartile Number')[['TotalScore_13']].mean().plot( kind = 'line', title = 'Absolute Total Facet scores mean line plot low to high wealth', xticks = np.arange(1,5,step = 1)).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[96]:
<matplotlib.legend.Legend at 0x26135e0b490>
No description has been provided for this image
In [97]:
# Absolute Facet scores mean line plot from low to high wealth

df4.groupby('Quartile Number')[['Certainty_3','RiskComprehension_3','Numeracy_3','GraphLiteracy_3','Bayesianreasoning_1']].mean().plot( kind = 'line', title = 'Absolute Facet scores mean line plot low to high wealth', xticks = np.arange(1,5,step = 1)).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[97]:
<matplotlib.legend.Legend at 0x26134150610>
No description has been provided for this image
In [98]:
# Normalised Facet scores mean line plot from low to high wealth


df4.groupby('Quartile Number')[['Certainty_%','RiskComprehension_%','Numeracy_%','GraphLiteracy_%','Bayesianreasoning_%','TotalScore_%']].mean().plot( kind = 'line', title = '% Facet scores mean line plot from low to high wealth',  xticks = np.arange(1,5,step = 1)).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[98]:
<matplotlib.legend.Legend at 0x2613561ad90>
No description has been provided for this image
In [99]:
# Normalised mean scores for each facet stacked

df4.groupby('Quartile Number')[['Certainty_%','RiskComprehension_%','Numeracy_%','GraphLiteracy_%','Bayesianreasoning_%']].mean().plot( kind = 'bar', title = '% mean scores for each facet stacked', stacked = True).legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[99]:
<matplotlib.legend.Legend at 0x261321265d0>
No description has been provided for this image
In [100]:
# Normalised mean scores for each facet for each wealth response Quartile

df4.groupby('Quartile Number')[['Certainty_%','RiskComprehension_%','Numeracy_%','GraphLiteracy_%','Bayesianreasoning_%','TotalScore_%']].mean().T.plot(kind = 'bar', title = '% mean scores for each facet for each wealth response category').legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
Out[100]:
<matplotlib.legend.Legend at 0x26133d0ea50>
No description has been provided for this image
In [101]:
# Trend line for Absolute Total Facet Score vs Quartiles

sns.regplot (data = df4, x = 'Quartile Number', y = 'TotalScore_13')
Out[101]:
<Axes: xlabel='Quartile Number', ylabel='TotalScore_13'>
No description has been provided for this image
In [102]:
# Trend line for Absolute Independent Facet Score vs Quartiles

fig2, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df4, x = 'Quartile Number', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax2, label='Certainty_3')
sns.regplot (data = df4, x = 'Quartile Number', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax2, label='RiskComprehension_3')
sns.regplot (data = df4, x = 'Quartile Number', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax2, label='Numeracy_3')
sns.regplot (data = df4, x = 'Quartile Number', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax2, label='GraphLiteracy_3')
sns.regplot (data = df4, x = 'Quartile Number', y = 'Bayesianreasoning_1',fit_reg=True, ci=None, ax=ax2, label='Bayesianreasoning_1' )

ax2.set(ylabel='Scores', xlabel='wealth')
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [103]:
# Violine Plot for TotalScore_13 for each entry under Wealth Quartiles.

sns.violinplot( data = df4, x = 'Quartile Number', y = 'TotalScore_13')
Out[103]:
<Axes: xlabel='Quartile Number', ylabel='TotalScore_13'>
No description has been provided for this image
In [104]:
# Violine Plot for Certainty_3 for each entry under Wealth Quartiles.

sns.violinplot( data = df4, x = 'Quartile Number', y = 'Certainty_3')
Out[104]:
<Axes: xlabel='Quartile Number', ylabel='Certainty_3'>
No description has been provided for this image
In [105]:
# Violine Plot for RiskComprehension_3 for each entry under Wealth Quartiles.

sns.violinplot( data = df4, x = 'Quartile Number', y = 'RiskComprehension_3')
Out[105]:
<Axes: xlabel='Quartile Number', ylabel='RiskComprehension_3'>
No description has been provided for this image
In [106]:
# Violine Plot for GraphLiteracy_3 for each entry under Wealth Quartiles.

sns.violinplot( data = df4, x = 'Quartile Number', y = 'GraphLiteracy_3')
Out[106]:
<Axes: xlabel='Quartile Number', ylabel='GraphLiteracy_3'>
No description has been provided for this image
In [107]:
# Violine Plot for Numeracy_3 for each entry under Wealth Quartiles.

sns.violinplot( data = df4, x = 'Quartile Number', y = 'Numeracy_3')
Out[107]:
<Axes: xlabel='Quartile Number', ylabel='Numeracy_3'>
No description has been provided for this image
In [108]:
# Violine Plot for Bayesianreasoning_1 for each entry under Wealth Quartiles.

sns.violinplot( data = df4, x = 'Quartile Number', y = 'Bayesianreasoning_1')
Out[108]:
<Axes: xlabel='Quartile Number', ylabel='Bayesianreasoning_1'>
No description has been provided for this image
In [ ]:
 
In [ ]:
 

WEALTH vs SCORES w/ ISCED classification¶

In [109]:
# Descriptive stats for the data set, isced = 1
# NA values of wealth are removed

df6 = df5.dropna(axis = 0, subset = 'wealth')
# df6.drop(df6[df6['wealth'] == 3500000].index, inplace = True)
df6.loc[df6['isced']==1][['wealth']].describe()
Out[109]:
wealth
count 3.980000e+02
mean 1.054044e+07
std 3.861003e+07
min 0.000000e+00
25% 3.500000e+05
50% 1.200000e+06
75% 6.000000e+06
max 5.000000e+08
In [110]:
# Descriptive stats for the data set, isced = 2

df6.loc[df6['isced']==2][['wealth']].describe()
Out[110]:
wealth
count 3.030000e+02
mean 9.678278e+06
std 4.966394e+07
min 0.000000e+00
25% 3.000000e+05
50% 8.000000e+05
75% 4.250000e+06
max 6.000000e+08
In [111]:
# Descriptive stats for the data set, isced = 3

df6.loc[df6['isced']==3][['wealth']].describe()
Out[111]:
wealth
count 3.100000e+01
mean 2.248115e+06
std 5.935955e+06
min 0.000000e+00
25% 3.250000e+04
50% 2.000000e+05
75% 1.050250e+06
max 3.000000e+07
In [112]:
# Trend line for Absolute Tota Facet Score vs wealth reponses sorted by isced and ORDERED by wealth WITH scatter

fig, ax7 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df6.loc[df6['isced']==1].reset_index(drop = True), x = df6.loc[df6['isced']==1].reset_index(drop = True)['wealth'], y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax7, label='ISCED = 1')
sns.regplot (data = df6.loc[df6['isced']==2].reset_index(drop = True), x = df6.loc[df6['isced']==2].reset_index(drop = True)['wealth'], y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax7, label='ISCED = 2')
sns.regplot (data = df6.loc[df6['isced']==3].reset_index(drop = True), x = df6.loc[df6['isced']==3].reset_index(drop = True)['wealth'], y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax7, label='ISCED = 3')

ax7.set(ylabel='Total Scores_19', xlabel='Wealth')
ax7.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [113]:
# Trend line for Absolute Tota Facet Score vs wealth reponses sorted by isced and ORDERED by wealth WITHOUT scatter

fig, ax8 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df6.loc[df6['isced']==1].reset_index(drop = True), x = df6.loc[df6['isced']==1].reset_index(drop = True)['wealth'], y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 1')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==2].reset_index(drop = True), x = df6.loc[df6['isced']==2].reset_index(drop = True)['wealth'], y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 2')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==3].reset_index(drop = True), x = df6.loc[df6['isced']==3].reset_index(drop = True)['wealth'], y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 3')

ax8.set(ylabel='Total Scores_19', xlabel='Wealth')
ax8.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [114]:
# Trend line for Absolute Certainty Score vs wealth reponses sorted by isced and ORDERED by wealth WITHOUT scatter

fig, ax9 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df6.loc[df6['isced']==1].reset_index(drop = True), x = df6.loc[df6['isced']==1].reset_index(drop = True)['wealth'], y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 1')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==2].reset_index(drop = True), x = df6.loc[df6['isced']==2].reset_index(drop = True)['wealth'], y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 2')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==3].reset_index(drop = True), x = df6.loc[df6['isced']==3].reset_index(drop = True)['wealth'], y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 3')

ax9.set(ylabel='Certainty_3', xlabel='Wealth')
ax9.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [115]:
# Trend line for Absolute Uncertainty Score vs wealth reponses sorted by isced and ORDERED by wealth WITHOUT scatter

fig, ax10 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df6.loc[df6['isced']==1].reset_index(drop = True), x = df6.loc[df6['isced']==1].reset_index(drop = True)['wealth'], y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 1')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==2].reset_index(drop = True), x = df6.loc[df6['isced']==2].reset_index(drop = True)['wealth'], y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 2')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==3].reset_index(drop = True), x = df6.loc[df6['isced']==3].reset_index(drop = True)['wealth'], y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 3')

ax10.set(ylabel='RiskComprehension_3', xlabel='Wealth')
ax10.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [116]:
# Trend line for Absolute Number Comprehension Score vs wealth reponses sorted by isced and ORDERED by wealth WITHOUT scatter

fig, ax11 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df6.loc[df6['isced']==1].reset_index(drop = True), x = df6.loc[df6['isced']==1].reset_index(drop = True)['wealth'], y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 1')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==2].reset_index(drop = True), x = df6.loc[df6['isced']==2].reset_index(drop = True)['wealth'], y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 2')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==3].reset_index(drop = True), x = df6.loc[df6['isced']==3].reset_index(drop = True)['wealth'], y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 3')

ax11.set(ylabel='Numeracy_3', xlabel='Wealth')
ax11.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [117]:
# Trend line for Absolute Graph Comprehension Score vs wealth reponses sorted by isced and ORDERED by wealth WITHOUT scatter

fig, ax11 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df6.loc[df6['isced']==1].reset_index(drop = True), x = df6.loc[df6['isced']==1].reset_index(drop = True)['wealth'], y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 1')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==2].reset_index(drop = True), x = df6.loc[df6['isced']==2].reset_index(drop = True)['wealth'], y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 2')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==3].reset_index(drop = True), x = df6.loc[df6['isced']==3].reset_index(drop = True)['wealth'], y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 3')

ax11.set(ylabel='GraphLiteracy_3', xlabel='Wealth')
ax11.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [118]:
# Trend line for Absolute Bayesian Reasoning Score vs wealth reponses sorted by isced and ORDERED by wealth WITHOUT scatter

fig, ax12 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df6.loc[df6['isced']==1].reset_index(drop = True), x = df6.loc[df6['isced']==1].reset_index(drop = True)['wealth'], y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 1')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==2].reset_index(drop = True), x = df6.loc[df6['isced']==2].reset_index(drop = True)['wealth'], y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 2')
sns.regplot (scatter = False, data = df6.loc[df6['isced']==3].reset_index(drop = True), x = df6.loc[df6['isced']==3].reset_index(drop = True)['wealth'], y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 3')

ax12.set(ylabel='Bayesianreasoning_1', xlabel='Wealth')
ax12.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [ ]:
 
In [ ]:
 

WEALTH Quartile Number vs SCORES w/ ISCED and AGE based classification¶

In [119]:
# Descriptive stats for the data set, isced = 1
# NA values of wealth are removed

df4.loc[df4['isced']==1].describe()
Out[119]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
count 398.000000 398.000000 398.0 398.000000 3.980000e+02 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000 398.000000
mean 35.707286 2.459799 1.0 2.339196 1.054044e+07 0.816583 1.263819 1.319095 1.648241 0.241206 27.219430 31.595477 43.969849 54.941374 24.120603 5.288945 38.678282 2.530151
std 9.743647 0.587135 0.0 1.084826 3.861003e+07 0.862908 0.865369 0.958161 0.909997 0.428353 28.763614 21.634232 31.938704 30.333244 42.835348 2.072837 15.401241 1.121283
min 20.000000 2.000000 1.0 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 7.142857 1.000000
25% 30.500000 2.000000 1.0 2.000000 3.500000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429 2.000000
50% 30.500000 2.000000 1.0 2.000000 1.200000e+06 1.000000 1.000000 1.000000 2.000000 0.000000 33.333333 25.000000 33.333333 66.666667 0.000000 5.000000 38.461538 3.000000
75% 40.500000 3.000000 1.0 3.000000 6.000000e+06 2.000000 2.000000 2.000000 2.000000 0.000000 66.666667 50.000000 66.666667 66.666667 0.000000 7.000000 50.000000 4.000000
max 70.500000 4.000000 1.0 5.000000 5.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 10.000000 76.923077 4.000000
In [120]:
df4.loc[df4['isced']==2].describe()
Out[120]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
count 303.000000 303.000000 303.0 303.000000 3.030000e+02 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000 303.000000
mean 32.826733 2.326733 2.0 1.914191 9.678278e+06 0.980198 1.330033 1.363036 1.623762 0.310231 32.673267 33.250825 45.434543 54.125413 31.023102 5.607261 41.549704 2.320132
std 9.875492 0.547884 0.0 1.002924 4.966394e+07 0.909627 0.964600 0.969854 0.791321 0.463353 30.320898 24.114993 32.328452 26.377357 46.335333 2.140947 16.277837 1.067192
min 19.000000 2.000000 2.0 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000
25% 26.000000 2.000000 2.0 1.000000 3.000000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429 1.000000
50% 30.500000 2.000000 2.0 2.000000 8.000000e+05 1.000000 1.000000 1.000000 2.000000 0.000000 33.333333 25.000000 33.333333 66.666667 0.000000 5.000000 38.461538 2.000000
75% 40.500000 3.000000 2.0 2.000000 4.250000e+06 2.000000 2.000000 2.000000 2.000000 1.000000 66.666667 50.000000 66.666667 66.666667 100.000000 7.000000 53.846154 3.000000
max 70.000000 4.000000 2.0 5.000000 6.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 11.000000 84.615385 4.000000
In [121]:
df4.loc[df4['isced']==3].describe()
Out[121]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
count 31.000000 31.000000 31.0 31.000000 3.100000e+01 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000 31.000000
mean 34.483871 2.451613 3.0 1.580645 2.248115e+06 1.129032 0.935484 0.967742 1.451613 0.225806 37.634409 23.387097 32.258065 48.387097 22.580645 4.709677 34.650833 1.709677
std 13.560656 0.767624 0.0 1.057487 5.935955e+06 0.921663 0.679975 1.048296 0.994609 0.425024 30.722094 16.999367 34.943204 33.153638 42.502372 2.268532 16.671659 1.006431
min 16.000000 0.000000 3.0 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000
25% 22.750000 2.000000 3.0 1.000000 3.250000e+04 0.000000 0.500000 0.000000 1.000000 0.000000 0.000000 12.500000 0.000000 33.333333 0.000000 3.000000 21.428571 1.000000
50% 30.500000 2.000000 3.0 1.000000 2.000000e+05 1.000000 1.000000 1.000000 1.000000 0.000000 33.333333 25.000000 33.333333 33.333333 0.000000 5.000000 35.714286 1.000000
75% 40.500000 3.000000 3.0 2.000000 1.050250e+06 2.000000 1.000000 2.000000 2.000000 0.000000 66.666667 25.000000 66.666667 66.666667 0.000000 6.000000 46.153846 2.500000
max 70.500000 4.000000 3.0 5.000000 3.000000e+07 3.000000 2.000000 3.000000 3.000000 1.000000 100.000000 50.000000 100.000000 100.000000 100.000000 9.000000 64.285714 4.000000
In [122]:
# Trend line for Absolute Tota Facet Score vs Quartile Number reponses sorted by isced and ORDERED by Quartile Number WITH scatter

fig, ax7 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df4.loc[df4['isced']==1].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[df4['isced']==1]['TotalScore_13'], fit_reg=True, ci=None, ax=ax7, label='ISCED = 1')
sns.regplot (data = df4.loc[df4['isced']==2].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[df4['isced']==2]['TotalScore_13'], fit_reg=True, ci=None, ax=ax7, label='ISCED = 2')
sns.regplot (data = df4.loc[df4['isced']==3].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[df4['isced']==3]['TotalScore_13'], fit_reg=True, ci=None, ax=ax7, label='ISCED = 3')

ax7.set(ylabel='Total Scores_19', xlabel='WEALTH Quartile Number')
ax7.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [123]:
# Trend line for Absolute Tota Facet Score vs Quartile Number reponses sorted by isced and ORDERED by Quartile Number WITHOUT scatter

fig, ax8 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[df4['isced']==1].reset_index(drop = True), x = 'Quartile Number', y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==2].reset_index(drop = True), x = 'Quartile Number', y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==3].reset_index(drop = True), x = 'Quartile Number', y = 'TotalScore_13', fit_reg=True, ci=None, ax=ax8, label='ISCED = 3')

ax8.set(ylabel='Total Scores_19', xlabel='WEALTH Quartile Number')
ax8.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [124]:
# Trend line for Absolute Certainty Score vs Quartile Number reponses sorted by isced and ORDERED by Quartile Number WITHOUT scatter

fig, ax9 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[df4['isced']==1].reset_index(drop = True), x = 'Quartile Number', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==2].reset_index(drop = True), x = 'Quartile Number', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==3].reset_index(drop = True), x = 'Quartile Number', y = 'Certainty_3', fit_reg=True, ci=None, ax=ax9, label='ISCED = 3')

ax9.set(ylabel='Certainty_3', xlabel='WEALTH Quartile Number')
ax9.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [125]:
# Trend line for Absolute Risk Comprehension Score vs Quartile Number reponses sorted by isced and ORDERED by Quartile Number WITHOUT scatter

fig, ax10 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[df4['isced']==1].reset_index(drop = True), x = 'Quartile Number', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==2].reset_index(drop = True), x = 'Quartile Number', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==3].reset_index(drop = True), x = 'Quartile Number', y = 'RiskComprehension_3', fit_reg=True, ci=None, ax=ax10, label='ISCED = 3')

ax10.set(ylabel='RiskComprehension_3', xlabel='WEALTH Quartile Number')
ax10.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [126]:
# Trend line for Absolute Number Comprehension Score vs Quartile Number reponses sorted by isced and ORDERED by Quartile Number WITHOUT scatter

fig, ax11 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[df4['isced']==1].reset_index(drop = True), x = 'Quartile Number', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==2].reset_index(drop = True), x = 'Quartile Number', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==3].reset_index(drop = True), x = 'Quartile Number', y = 'Numeracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 3')

ax11.set(ylabel='Numeracy_3', xlabel='WEALTH Quartile Number')
ax11.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [127]:
# Trend line for Absolute Graph Comprehension Score vs Quartile Number reponses sorted by isced and ORDERED by Quartile Number WITHOUT scatter

fig, ax11 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[df4['isced']==1].reset_index(drop = True), x = 'Quartile Number', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==2].reset_index(drop = True), x = 'Quartile Number', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==3].reset_index(drop = True), x = 'Quartile Number', y = 'GraphLiteracy_3', fit_reg=True, ci=None, ax=ax11, label='ISCED = 3')

ax11.set(ylabel='GraphLiteracy_3', xlabel='WEALTH Quartile Number')
ax11.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [128]:
# Trend line for Absolute Bayesian Reasoning Score vs Quartile Number reponses sorted by isced and ORDERED by Quartile Number WITHOUT scatter

fig, ax12 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[df4['isced']==1].reset_index(drop = True), x = 'Quartile Number', y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==2].reset_index(drop = True), x = 'Quartile Number', y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[df4['isced']==3].reset_index(drop = True), x = 'Quartile Number', y = 'Bayesianreasoning_1', fit_reg=True, ci=None, ax=ax12, label='ISCED = 3')

ax12.set(ylabel='Bayesianreasoning_1', xlabel='WEALTH Quartile Number')
ax12.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [129]:
df4
Out[129]:
ResponseId age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
0 R_4fNO2Z5GF8KerZI 24.0 2 2 2 0.0 3 2 1 2 1 100.000000 50.0 33.333333 66.666667 100.0 9 69.230769 1
1 e7ty2tbwa1hcmte7ty683aw64pla7689 30.5 2 2 1 0.0 0 1 1 1 0 0.000000 25.0 33.333333 33.333333 0.0 3 21.428571 1
2 R_4lnmGavSf6rw1eE 31.0 2 1 1 0.0 0 2 1 1 0 0.000000 50.0 33.333333 33.333333 0.0 4 30.769231 1
3 R_4MJAzsNYYA69Y8p 27.0 2 3 1 0.0 2 1 1 2 1 66.666667 25.0 33.333333 66.666667 100.0 7 53.846154 1
4 R_41bfnamM0zpH94i 30.0 2 1 2 0.0 2 2 1 1 1 66.666667 50.0 33.333333 33.333333 100.0 7 53.846154 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
727 ss5olpa7actdndl6gbkfpvss5olp2jex 21.5 2 2 4 300000000.0 0 2 2 1 0 0.000000 50.0 66.666667 33.333333 0.0 5 35.714286 4
728 lmoqk1qcf44jqqudwkplmoqk18cao0fs 40.5 3 1 2 400000000.0 1 1 1 1 0 33.333333 25.0 33.333333 33.333333 0.0 4 28.571429 4
729 35zux4sc18rplyz3dc85z35zux4sdfm4 21.5 2 2 4 500000000.0 1 1 0 1 0 33.333333 25.0 0.000000 33.333333 0.0 3 21.428571 4
730 wn9mk6m1k8o10l1twn9mk6b4z7l7yvhc 50.5 3 1 3 500000000.0 1 2 3 3 0 33.333333 50.0 100.000000 100.000000 0.0 9 64.285714 4
731 zcj7ldokhyo6217f9sriwizcj7ldodwt 40.5 3 2 3 600000000.0 1 3 1 1 0 33.333333 75.0 33.333333 33.333333 0.0 6 42.857143 4

732 rows × 19 columns

In [130]:
# Since we already have a classification for Age groups in the form of age_rec, we will use that.
# We will also use median of age to see if it yields any relevant results, as instructed.

# AXES to be used = Age or age groups, ISCED, Income

# Age groups = [2,3,4]
# Age group 2 = 18 to 35 y/o
# Age group 3 = 36 to 59 y/o
# Age group 4 = 60 to 75 y/o (75 y/o, i.e, within the scope of the data we have, it can mean 60 and above also)
In [131]:
df4.loc[(df4['age_rec']==2)].describe()
Out[131]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
count 466.000000 466.0 466.000000 466.000000 4.660000e+02 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000 466.000000
mean 28.287554 2.0 1.532189 2.042918 7.569898e+06 0.907725 1.291845 1.328326 1.609442 0.263948 30.257511 32.296137 44.277539 53.648069 26.394850 5.401288 39.912984 2.291845
std 3.834470 0.0 0.564195 1.021428 3.143664e+07 0.898065 0.927836 0.960249 0.848678 0.441245 29.935502 23.195899 32.008291 28.289274 44.124539 2.094519 15.865633 1.055767
min 19.000000 2.0 1.000000 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000
25% 25.000000 2.0 1.000000 1.000000 3.000000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429 1.000000
50% 30.500000 2.0 1.000000 2.000000 8.999995e+05 1.000000 1.000000 1.000000 1.000000 0.000000 33.333333 25.000000 33.333333 33.333333 0.000000 5.000000 38.461538 2.000000
75% 30.500000 2.0 2.000000 2.000000 3.425000e+06 2.000000 2.000000 2.000000 2.000000 1.000000 66.666667 50.000000 66.666667 66.666667 100.000000 7.000000 50.000000 3.000000
max 35.000000 2.0 3.000000 5.000000 5.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 11.000000 84.615385 4.000000
In [132]:
df4.loc[(df4['age_rec']==3)].describe()
Out[132]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
count 232.000000 232.0 232.000000 232.000000 2.320000e+02 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000 232.000000
mean 42.892241 3.0 1.426724 2.306034 1.445481e+07 0.875000 1.245690 1.284483 1.655172 0.280172 29.166667 31.142241 42.816092 55.172414 28.017241 5.340517 38.961254 2.538793
std 4.753812 0.0 0.591258 1.138221 6.124404e+07 0.881201 0.875337 0.987419 0.898324 0.450054 29.373366 21.883428 32.913966 29.944135 45.005432 2.182277 16.150284 1.172652
min 36.000000 3.0 1.000000 1.000000 3.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000
25% 40.500000 3.0 1.000000 1.750000 3.000000e+05 0.000000 1.000000 0.000000 1.000000 0.000000 0.000000 25.000000 0.000000 33.333333 0.000000 4.000000 28.571429 1.000000
50% 40.500000 3.0 1.000000 2.000000 1.750000e+06 1.000000 1.000000 1.000000 2.000000 0.000000 33.333333 25.000000 33.333333 66.666667 0.000000 5.000000 37.087912 3.000000
75% 46.500000 3.0 2.000000 3.000000 7.500000e+06 2.000000 2.000000 2.000000 2.000000 1.000000 66.666667 50.000000 66.666667 66.666667 100.000000 7.000000 50.000000 4.000000
max 54.000000 3.0 3.000000 5.000000 6.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 10.000000 76.923077 4.000000
In [133]:
df4.loc[(df4['age_rec']==4)].describe()
Out[133]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
count 33.000000 33.0 33.000000 33.000000 3.300000e+01 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000 33.000000
mean 62.969697 4.0 1.484848 2.181818 9.582270e+06 0.848485 1.303030 1.545455 1.727273 0.272727 28.282828 32.575758 51.515152 57.575758 27.272727 5.696970 41.608392 3.181818
std 4.390934 0.0 0.618527 1.236288 1.406214e+07 0.755034 0.769937 0.938446 0.910794 0.452267 25.167787 19.248426 31.281550 30.359795 45.226702 2.038456 14.956308 0.950478
min 57.000000 4.0 1.000000 1.000000 1.000000e+05 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 2.000000 14.285714 1.000000
25% 60.500000 4.0 1.000000 1.000000 1.250000e+06 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429 3.000000
50% 60.500000 4.0 1.000000 2.000000 5.000000e+06 1.000000 1.000000 2.000000 2.000000 0.000000 33.333333 25.000000 66.666667 66.666667 0.000000 6.000000 42.857143 3.000000
75% 65.000000 4.0 2.000000 2.000000 1.000000e+07 1.000000 2.000000 2.000000 2.000000 1.000000 33.333333 50.000000 66.666667 66.666667 100.000000 8.000000 57.142857 4.000000
max 70.500000 4.0 3.000000 5.000000 5.250000e+07 2.000000 3.000000 3.000000 3.000000 1.000000 66.666667 75.000000 100.000000 100.000000 100.000000 9.000000 64.285714 4.000000
In [ ]:
 
In [134]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (data = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (data = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Total Scores_14', xlabel='WEALTH Quartile Number for age 18 to 35')
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (data = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (data = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Total Scores_14', xlabel='WEALTH Quartile Number for age 36 to 55')
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (data = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (data = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Total Scores_14', xlabel='WEALTH Quartile Number for age 56 and above')
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [135]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df4.loc[ df4['age_rec']==2  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==2  ].groupby(['Quartile Number']).mean(numeric_only=True)['TotalScore_13'], yerr = df4.loc[ (df4['age_rec']==2) ].groupby(['Quartile Number'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Total Scores_14', xlabel='WEALTH Quartile Number for age 18 to 35',  yticks = np.arange(5, 16 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Total Scores_14', xlabel='WEALTH Quartile Number for age 36 to 55',  yticks = np.arange(5, 16 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df4.loc[ df4['age_rec']==3  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==3  ].groupby(['Quartile Number']).mean(numeric_only=True)['TotalScore_13'], yerr = df4.loc[ (df4['age_rec']==3) ].groupby(['Quartile Number'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Total Scores_14', xlabel='WEALTH Quartile Number for age 56 and above',  yticks = np.arange(5, 16 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df4.loc[ df4['age_rec']== 4 ]['Quartile Number'].unique(), y = df4.loc[ df4['age_rec']==4  ].groupby(['Quartile Number']).mean(numeric_only=True)['TotalScore_13'], yerr = df4.loc[ (df4['age_rec']==4) ].groupby(['Quartile Number'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [136]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Certainty_3', xlabel='WEALTH Quartile Number for age 18 to 35',  yticks = np.arange(0, 6 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df4.loc[ df4['age_rec']==2  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==2  ].groupby(['Quartile Number'])['Certainty_3'].mean(), yerr = df4.loc[ (df4['age_rec']==2) ].groupby(['Quartile Number'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Certainty_3', xlabel='WEALTH Quartile Number for age 36 to 55',  yticks = np.arange(0, 6 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df4.loc[ df4['age_rec']==3  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==3  ].groupby(['Quartile Number'])['Certainty_3'].mean(), yerr = df4.loc[ (df4['age_rec']==3) ].groupby(['Quartile Number'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Certainty_3', xlabel='WEALTH Quartile Number for age 56 and above',  yticks = np.arange(0, 6 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df4.loc[ df4['age_rec']== 4 ]['Quartile Number'].unique(), y = df4.loc[ df4['age_rec']==4  ].groupby(['Quartile Number'])['Certainty_3'].mean(), yerr = df4.loc[ (df4['age_rec']==4) ].groupby(['Quartile Number'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [137]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='RiskComprehension_3', xlabel='WEALTH Quartile Number for age 18 to 35',  yticks = np.arange(0, 3 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df4.loc[ df4['age_rec']==2  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==2  ].groupby(['Quartile Number'])['RiskComprehension_3'].mean(), yerr = df4.loc[ (df4['age_rec']==2) ].groupby(['Quartile Number'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='RiskComprehension_3', xlabel='WEALTH Quartile Number for age 36 to 55',  yticks = np.arange(0, 3 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df4.loc[ df4['age_rec']==3  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==3  ].groupby(['Quartile Number'])['RiskComprehension_3'].mean(), yerr = df4.loc[ (df4['age_rec']==3) ].groupby(['Quartile Number'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='RiskComprehension_3', xlabel='WEALTH Quartile Number for age 56 and above',  yticks = np.arange(0, 3 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df4.loc[ df4['age_rec']== 4 ]['Quartile Number'].unique(), y = df4.loc[ df4['age_rec']==4  ].groupby(['Quartile Number'])['RiskComprehension_3'].mean(), yerr = df4.loc[ (df4['age_rec']==4) ].groupby(['Quartile Number'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [138]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Numeracy_3', xlabel='WEALTH Quartile Number for age 18 to 35',  yticks = np.arange(0, 6 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df4.loc[ df4['age_rec']==2  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==2  ].groupby(['Quartile Number'])['Numeracy_3'].mean(), yerr = df4.loc[ (df4['age_rec']==2) ].groupby(['Quartile Number'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Numeracy_3', xlabel='WEALTH Quartile Number for age 36 to 55',  yticks = np.arange(0, 6 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df4.loc[ df4['age_rec']==3  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==3  ].groupby(['Quartile Number'])['Numeracy_3'].mean(), yerr = df4.loc[ (df4['age_rec']==3) ].groupby(['Quartile Number'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Numeracy_3', xlabel='WEALTH Quartile Number for age 56 and above',  yticks = np.arange(0, 6 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df4.loc[ df4['age_rec']== 4 ]['Quartile Number'].unique(), y = df4.loc[ df4['age_rec']==4  ].groupby(['Quartile Number'])['Numeracy_3'].mean(), yerr = df4.loc[ (df4['age_rec']==4) ].groupby(['Quartile Number'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [139]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='GraphLiteracy_3', xlabel='WEALTH Quartile Number for age 18 to 35',  yticks = np.arange(0, 4 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df4.loc[ df4['age_rec']==2  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==2  ].groupby(['Quartile Number'])['GraphLiteracy_3'].mean(), yerr = df4.loc[ (df4['age_rec']==2) ].groupby(['Quartile Number'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='GraphLiteracy_3', xlabel='WEALTH Quartile Number for age 36 to 55',  yticks = np.arange(0, 4 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df4.loc[ df4['age_rec']==3  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==3  ].groupby(['Quartile Number'])['GraphLiteracy_3'].mean(), yerr = df4.loc[ (df4['age_rec']==3) ].groupby(['Quartile Number'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='GraphLiteracy_3', xlabel='WEALTH Quartile Number for age 56 and above',  yticks = np.arange(0, 4 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df4.loc[ df4['age_rec']== 4 ]['Quartile Number'].unique(), y = df4.loc[ df4['age_rec']==4  ].groupby(['Quartile Number'])['GraphLiteracy_3'].mean(), yerr = df4.loc[ (df4['age_rec']==4) ].groupby(['Quartile Number'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [140]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==2) & (df4['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Bayesianreasoning_1', xlabel='WEALTH Quartile Number for age 18 to 35',  yticks = np.arange(0, 5 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax1.errorbar(x = df4.loc[ df4['age_rec']==2  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==2  ].groupby(['Quartile Number'])['Bayesianreasoning_1'].mean(), yerr = df4.loc[ (df4['age_rec']==2) ].groupby(['Quartile Number'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==3) & (df4['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Bayesianreasoning_1', xlabel='WEALTH Quartile Number for age 36 to ',  yticks = np.arange(0, 5 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax2.errorbar(x = df4.loc[ df4['age_rec']==3  ]["Quartile Number"].unique(), y = df4.loc[ df4['age_rec']==3  ].groupby(['Quartile Number'])['Bayesianreasoning_1'].mean(), yerr = df4.loc[ (df4['age_rec']==3) ].groupby(['Quartile Number'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()

fig, ax3 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age_rec']==4) & (df4['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax3, label='ISCED = 3')

ax3.set(ylabel='Bayesianreasoning_1', xlabel='WEALTH Quartile Number for age 56 and above',  yticks = np.arange(0, 5 , 1))
ax3.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
ax3.errorbar(x = df4.loc[ df4['age_rec']== 4 ]['Quartile Number'].unique(), y = df4.loc[ df4['age_rec']==4  ].groupby(['Quartile Number'])['Bayesianreasoning_1'].mean(), yerr = df4.loc[ (df4['age_rec']==4) ].groupby(['Quartile Number'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [141]:
# Age mean method
# Age_mean
In [142]:
age_m = df2["age"].median()
age_m
Out[142]:
30.5
In [ ]:
 
In [143]:
df4["Quartile Number"].value_counts()
Out[143]:
Quartile Number
1    201
2    190
3    182
4    159
Name: count, dtype: int64
In [ ]:
 
In [ ]:
 
In [144]:
df4.loc[(df4['age'] < age_m)].describe()
Out[144]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
count 193.000000 193.000000 193.000000 193.000000 1.930000e+02 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000 193.000000
mean 24.455959 1.989637 1.715026 1.911917 9.658172e+06 1.202073 1.404145 1.409326 1.512953 0.331606 40.069085 35.103627 46.977547 50.431779 33.160622 5.860104 44.189489 2.160622
std 3.143177 0.143963 0.574304 1.034566 4.517310e+07 0.927360 0.925554 0.970028 0.736750 0.472015 30.911984 23.138839 32.334265 24.558323 47.201475 2.024875 15.528721 1.050845
min 16.000000 0.000000 1.000000 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 7.142857 1.000000
25% 21.500000 2.000000 1.000000 1.000000 2.000000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 5.000000 35.714286 1.000000
50% 24.000000 2.000000 2.000000 2.000000 5.000000e+05 1.000000 1.000000 1.000000 1.000000 0.000000 33.333333 25.000000 33.333333 33.333333 0.000000 6.000000 46.153846 2.000000
75% 27.000000 2.000000 2.000000 2.000000 2.500000e+06 2.000000 2.000000 2.000000 2.000000 1.000000 66.666667 50.000000 66.666667 66.666667 100.000000 7.000000 53.846154 3.000000
max 30.000000 2.000000 3.000000 5.000000 5.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 11.000000 84.615385 4.000000
In [145]:
df4.loc[(df4['age'] >= age_m)].describe()
Out[145]:
age age_rec isced income wealth Certainty_3 RiskComprehension_3 GraphLiteracy_3 Numeracy_3 Bayesianreasoning_1 Certainty_% RiskComprehension_% GraphLiteracy_% Numeracy_% Bayesianreasoning_% TotalScore_13 TotalScore_% Quartile Number
count 539.000000 539.000000 539.000000 539.000000 5.390000e+02 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000 539.000000
mean 38.046382 2.552876 1.421150 2.209647 9.894761e+06 0.788497 1.231911 1.291280 1.671614 0.246753 26.283241 30.797774 43.042672 55.720470 24.675325 5.230056 38.087423 2.497217
std 9.240924 0.608556 0.561131 1.079816 4.197602e+07 0.849107 0.891942 0.967184 0.905247 0.431522 28.303566 22.298539 32.239456 30.174889 43.152237 2.126778 15.733497 1.114909
min 30.500000 2.000000 1.000000 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000
25% 30.500000 2.000000 1.000000 1.000000 3.000000e+05 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 25.000000 33.333333 33.333333 0.000000 4.000000 28.571429 1.000000
50% 35.000000 2.000000 1.000000 2.000000 1.200000e+06 1.000000 1.000000 1.000000 2.000000 0.000000 33.333333 25.000000 33.333333 66.666667 0.000000 5.000000 35.714286 3.000000
75% 40.500000 3.000000 2.000000 3.000000 5.000000e+06 1.000000 2.000000 2.000000 2.000000 0.000000 33.333333 50.000000 66.666667 66.666667 0.000000 7.000000 50.000000 3.000000
max 70.500000 4.000000 3.000000 5.000000 6.000000e+08 3.000000 3.000000 3.000000 3.000000 1.000000 100.000000 75.000000 100.000000 100.000000 100.000000 10.000000 76.923077 4.000000
In [ ]:
 
In [146]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (data = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (data = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.set(ylabel='Total Scores_19', xlabel='WEALTH Quartile Number for < median age')
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (data = df4.loc[(df4['age'] >= age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.set(ylabel='Total Scores_19', xlabel='WEALTH Quartile Number for >=median age')
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [147]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df4.loc[ (df4['age'] < age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] < age_m)  ].groupby(['Quartile Number'])['TotalScore_13'].mean(), yerr = df4.loc[ (df4['age'] < age_m) ].groupby(['Quartile Number'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Total Scores_19', xlabel='WEALTH Quartile Number for < median age',  yticks = np.arange(5, 16 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)]['TotalScore_13'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df4.loc[ (df4['age'] >= age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] >=age_m)  ].groupby(['Quartile Number'])['TotalScore_13'].mean(), yerr = df4.loc[ (df4['age'] >=age_m) ].groupby(['Quartile Number'])['TotalScore_13'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='Total Scores_19', xlabel='WEALTH Quartile Number for >=median age',  yticks = np.arange(5, 16 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [148]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df4.loc[ (df4['age'] < age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] < age_m)  ].groupby(['Quartile Number'])['Certainty_3'].mean(), yerr = df4.loc[ (df4['age'] < age_m) ].groupby(['Quartile Number'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Certainty_3', xlabel='WEALTH Quartile Number for < median age',  yticks = np.arange(0, 6 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)]['Certainty_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df4.loc[ (df4['age'] >= age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] >=age_m)  ].groupby(['Quartile Number'])['Certainty_3'].mean(), yerr = df4.loc[ (df4['age'] >=age_m) ].groupby(['Quartile Number'])['Certainty_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='Certainty_3', xlabel='WEALTH Quartile Number for >=median age')
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [149]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df4.loc[ (df4['age'] < age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] < age_m)  ].groupby(['Quartile Number'])['RiskComprehension_3'].mean(), yerr = df4.loc[ (df4['age'] < age_m) ].groupby(['Quartile Number'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='RiskComprehension_3', xlabel='WEALTH Quartile Number for < median age',  yticks = np.arange(0, 3 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)]['RiskComprehension_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df4.loc[ (df4['age'] >= age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] >=age_m)  ].groupby(['Quartile Number'])['RiskComprehension_3'].mean(), yerr = df4.loc[ (df4['age'] >=age_m) ].groupby(['Quartile Number'])['RiskComprehension_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='RiskComprehension_3', xlabel='WEALTH Quartile Number for >=median age',  yticks = np.arange(0, 3 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [150]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df4.loc[ (df4['age'] < age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] < age_m)  ].groupby(['Quartile Number'])['Numeracy_3'].mean(), yerr = df4.loc[ (df4['age'] < age_m) ].groupby(['Quartile Number'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Numeracy_3', xlabel='WEALTH Quartile Number for < median age',  yticks = np.arange(0, 6 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)]['Numeracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df4.loc[ (df4['age'] >= age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] >=age_m)  ].groupby(['Quartile Number'])['Numeracy_3'].mean(), yerr = df4.loc[ (df4['age'] >=age_m) ].groupby(['Quartile Number'])['Numeracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='Numeracy_3', xlabel='WEALTH Quartile Number for >=median age',  yticks = np.arange(0, 6 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [151]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df4.loc[ (df4['age'] < age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] < age_m)  ].groupby(['Quartile Number'])['GraphLiteracy_3'].mean(), yerr = df4.loc[ (df4['age'] < age_m) ].groupby(['Quartile Number'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='GraphLiteracy_3', xlabel='WEALTH Quartile Number for < median age',  yticks = np.arange(0, 4 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)]['GraphLiteracy_3'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df4.loc[ (df4['age'] >= age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] >=age_m)  ].groupby(['Quartile Number'])['GraphLiteracy_3'].mean(), yerr = df4.loc[ (df4['age'] >=age_m) ].groupby(['Quartile Number'])['GraphLiteracy_3'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='GraphLiteracy_3', xlabel='WEALTH Quartile Number for >=median age',  yticks = np.arange(0, 4 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [152]:
fig, ax1 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] < age_m) & (df4['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax1, label='ISCED = 3')

ax1.errorbar(x = df4.loc[ (df4['age'] < age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] < age_m)  ].groupby(['Quartile Number'])['Bayesianreasoning_1'].mean(), yerr = df4.loc[ (df4['age'] < age_m) ].groupby(['Quartile Number'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax1.set(ylabel='Bayesianreasoning_1', xlabel='WEALTH Quartile Number for < median age',  yticks = np.arange(0, 5 , 1))
ax1.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()

fig, ax2 = plt.subplots(figsize=(6, 6))

sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==1)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 1')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==2)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 2')
sns.regplot (scatter = False, data = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)].reset_index(drop = True), x = 'Quartile Number', y = df4.loc[(df4['age'] >=age_m) & (df4['isced']==3)]['Bayesianreasoning_1'], fit_reg=True, ci=None, ax=ax2, label='ISCED = 3')

ax2.errorbar(x = df4.loc[ (df4['age'] >= age_m)  ]["Quartile Number"].unique(), y = df4.loc[ (df4['age'] >=age_m)  ].groupby(['Quartile Number'])['Bayesianreasoning_1'].mean(), yerr = df4.loc[ (df4['age'] >=age_m) ].groupby(['Quartile Number'])['Bayesianreasoning_1'].sem(), fmt='o', color = lighten_color('gray',0.5))
ax2.set(ylabel='Bayesianreasoning_1', xlabel='WEALTH Quartile Number for >=median age',  yticks = np.arange(0, 5 , 1))
ax2.legend(loc='center left',bbox_to_anchor=(1.0, 0.5))
plt.show()
No description has been provided for this image
No description has been provided for this image
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: